Search code examples
c#wcfiiswsdlweb-config

wcf service @ iis - svc reachable but wsdl link not working


i wrote a wcf service and deployed it on a local iis without any problems.

local system:

  • windows 7 x64
  • iis 7.5

now i try to deploy my service on a remote system with iis server. i copyed the service.svc, web.config and the bin directory to a folder of the other system.

after that i added a new application to the default website and linked it to the folder containing my files. i opend the browser an tryed to reach the svc file.

file is displayed correct with both wsdl links, but whene i click the links the url changes but the site dont change. tryed this on the remote system and on local client. same beavior on both systems.

remote system:

  • windows server 2012 r2 x64
  • iis 8.5

what ive done:

  • added a service behavior which enables service metadata
  • set the httpGetEnabled=True on that service metadata behavior to allow http browsing to that metadata
  • added mex endpoint on my service

here my web.config:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="MetadateBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service
    behaviorConfiguration="MetadateBehavior"
    name="ServerLib.Handler.WcfReciveHandler">
    <endpoint 
      address=""
      binding="wsDualHttpBinding"
      contract="Common.Contracts.IServerContract" />
    <endpoint
      address="mex"
      binding="mexHttpBinding"
      contract="IMetadataExchange" />
  </service>
</services>

i found a similar post here but with no answer to my problem. (WCF hosting: Can access svc file but cannot go to wsdl link).

i enabled tracing on my service but no logs are created so far. so i think the service is not running. on my local system togs are created.

i tryed to add a service reference to my client project with the url of the svc file, but this ends with an error:

There was an error downloading '\http://dev.develop.local/asd/Service.svc/_vti_bin/ListData.svc/$metadata' The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved:

followed by html document - think the file that is displayd whene i access the svc file.

ive checked my application eventlog on the remote system and noticed following error that seems to be written whene i tryed to add the service reference:

WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/24984138 Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'https://dev.develop.local/asd/Service.svc/mex'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---> System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'https://dev.develop.local/asd/Service.svc/mex'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)

i hope that someone can help.


Solution

  • You are missing the configuration section for the connection binding for "wsDualHttpBinding". You need to add a bindingConfiguration attribute to your endpoint element and point it to a binding configuration element.

    It should look something like this (this is for wsHttpBinding not wsDualHttpBinding):

    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBinding" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="524288"
                    messageEncoding="Text" textEncoding="utf-8"
                    useDefaultWebProxy="true">
          <reliableSession enabled="true" ordered="true"/>
          <readerQuotas maxDepth="32" maxStringContentLength="52428800" maxArrayLength="52428800"
                        maxBytesPerRead="52428800" maxNameTableCharCount="52428800" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="None" algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>