Reputation: 469
I'm figthing for hours now to figure out this problem.
I have a wcf service that I host on II7, all works fine when I use the normal http protocol.
I added SSL capabilites and since then I cannot access it from code. I can create a client but cannot run any of its methods.
here is what I have
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttp0">
<security mode="Transport">
<transport realm ="" clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://serverName.domname.local/WCFTest/MyWebServicec.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttp0" contract="SSLWebService.IMyWebService"
name="WSEP">
<identity>
<dns value="serverName.domname.local" />
</identity>
</endpoint>
</client>
</system.serviceModel>
I added a service reference to my project
and I use it like that
Dim client As MyWebServiceClient = New MyWebServiceClient()
Try
client.GetDocumentByDocID(5)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
and here is what I get
There was no endpoint listening at https://serverName.domname.local/WCFTest/MyWebService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Can anyone help me on this? I really do not understand what is going on...
note: I can access the webservice correctly using Internet Explorer (so I guess my certificate is ok)
Upvotes: 12
Views: 16831
Reputation: 469
You were right about that,
Sg wrong on the server side.
here is how I made it working
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security mode="Transport">
<transport clientCredentialType ="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="App_WcfWebService.AppWebServiceBehavior" name="App_WcfWebService.AppWebService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration ="wsHttpEndpointBinding" contract="App_WcfWebService.IAppWebService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="App_WcfWebService.AppWebServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentSessions="90" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Upvotes: 3
Reputation: 8084
I think the server web.config might be the faulty one here. I've got WCF over SSL work with the following app.config on client side.
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" >
<security mode="Transport">
<transport realm ="" clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://mycomputer/Service/Service.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService"
contract="ServiceProxy.IService" name="WSHttpBinding_IService">
<identity>
<dns value="mycomputer" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
The only visible difference is ClientCredentialType which I have set to Windows as I want to use integrated windows authentication. The server web.config includes the following lines to setup the service which the client can consume.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WindowsBinding">
<security mode="Transport">
<transport proxyCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Service.Service1Behavior"
name="Service.Service">
<endpoint address="" binding="wsHttpBinding"
bindingConfiguration="WindowsBinding"
contract="ServiceInterface.IService">
<identity>
<dns value="mycomputer" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Could you compare this to your web.config on the server side and see what differs? Or add your web.config to the question.
Upvotes: 4