1

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.

Community
  • 1
  • 1
ich2211
  • 275
  • 4
  • 7

3 Answers3

1

thanks toadflakz. i finally got it. there have been several problems. your answer helps with one (point 2) of them.

  • the server and website i published the service only accepted https and my service dont provide the metadata via https. solution was to add httpsGetEnabled to my serviceMetadata.

    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
    

    that was the main problem of the wsdl file that was not loaded correctly. after adding this all went fine but communication failed - recived exceptions that point to a authentication problem - > thats point 2

  • wsDualHttpBinding requires as toadflakz said a bindingConfiguration. at least the information that no security mode is required. my binding config looks like this.

    <wsDualHttpBinding>
      <binding name="wsHttpDual">
        <security mode="None">
          <message clientCredentialType="None" algorithmSuite="Default" />
        </security>
      </binding>
    </wsDualHttpBinding>
    

    after that i added a new website for my service listening to http requests on a very high port. client seems to do something but recived a timeout. i added the port to incoming connections on server firewall but it was not enough - brings me to problem 3.

  • my communication was blocked by the client firewall. i added the server ip clientside - working fine now.

ich2211
  • 275
  • 4
  • 7
0

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>
toadflakz
  • 7,764
  • 1
  • 27
  • 40
  • thanks for ur reply. i tryed adding bindingConfiguration from microsoft exampe (http://msdn.microsoft.com/de-de/library/ms731821(v=vs.110).aspx), but it dont help. i've seen that there is always a https infront of my request, so i added httpsGetEnabled to my serviceMetadata. now i get the wsdl file and can add a service reference. but connection of my client still fails. – ich2211 Sep 03 '14 at 07:05
  • You will need to setup the `bindingConfiguration` `security` element for the type of https you are running. If you struggle to get it working, you may want to consider a custom binding as I've found this works much easier than the standard `wsHttpBinding` method. – toadflakz Sep 03 '14 at 08:04
0

Restarting the visual studio solved my problem, I know its weird, but for someone who has tried everything and still failed , just try restarting visual studio. Hope it helps some one.

Rajon Tanducar
  • 308
  • 4
  • 8