1
votes

I'm working on wcf service and I am very new to this. Here I had made some changes in web.config file according to the videos I had watched, but the following error had occurred and I don't know that what it is exactly asking.

Can any one please help me to solve this?

This is the error I am getting

Error: Cannot obtain Metadata from http://localhost:15305/Techieez.svc

If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata

Exchange Error URI: http://localhost:15305/Techieez.svc
Metadata contains a reference that cannot be resolved: 'http://localhost:15305/Techieez.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:15305/Techieez.svc.
The client and service bindings may be mismatched.

The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..

HTTP GET Error URI: http://localhost:15305/Techieez.svc
The HTML document does not contain Web service discovery information.

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="con" value="uid=sa;password=572572;database=techieez;server=techz"/>
    <add key="from" value="[email protected]"/>
    <add key="password" value="****"/>
    <add key="webPages:Version" value="2.0" />
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
    <add key="webpages:Enabled" value="true" />
    <add key="mail" value="smtp.gmail.com"/>
    <add key="visa" value="[email protected]"/>
    <add key="port" value="587"/>
    <add key="html" value="true"/>
    <add key="ssl" value="true"/>
    <add key="credit" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />    
    <sessionState cookieless="UseCookies" cookieName="user" timeout="525600" />
    <httpRuntime executionTimeout="500000" targetFramework="4.5" maxRequestLength="2000000" maxQueryStringLength="2000000" enable="true" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding_Techieez" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2097152"
            maxArrayLength="2097152" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="TechieezService.Techieez">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
          contract="TechieezService.ITechieez" />
        <endpoint address="Web" behaviorConfiguration="WebBehaviour"
          binding="webHttpBinding" bindingConfiguration="" name="WebEndPoint"
          contract="TechieezService.ITechieez" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="WebBehaviour">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="DefaultBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>
2
set behaviorConfiguration of service to DefaultBehaviour.Amit Kumar Ghosh
Somhow your config is not going to work. basicHttpBinding and webHttpBinding aren't going to work together.Amit Kumar Ghosh
is there any way to change my config file to previous state. if it is possible please help mesurya
I don't know about the previous stateAmit Kumar Ghosh
Rearrange your system. Service model section properlyAmit Kumar Ghosh

2 Answers

0
votes

That's not necessarily an error, it just means you cannot access the service metadata which is often done for security reasons. Your service may still work fine (assuming you've done the other 10,000 things you need to do to make WCF work), you would just need to know how to connect from the client without relying on, for instance, "Add Service Reference" from visual studio. But to enable the service metadata, add this endpoint to the <service>:

<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
0
votes
   <endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
      contract="TechieezService.ITechieez" />

You don't have a behavior specified for the basicHttpBinding, which looks like the one that would be used if you go to the url you have listed. You have a behavior that allows you get the metadata, but you aren't using it. Try changing it to this:

   <endpoint address="" behaviorConfiguration="DefaultBehaviour" 
   binding="basicHttpBinding" bindingConfiguration="" 
   contract="TechieezService.ITechieez" />