I'm migrating an existing service from HTTP (Dev/UAT) to HTTPS (Production), and I'm having trouble with the configuration. Here is the system.serviceModel section of my web.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
<services>
<service name="MyService">
<endpoint name="MyEndpoint" address="" binding="wsHttpBinding"
bindingConfiguration="secureBinding" contract="IMyService" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="secureBinding">
<security mode="Transport"></security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
I've tried this using both basicHttpBinding
and wsHttpBinding
, with the same results:
http://server.domain.com/MyService.svc
https://server.domain.com/MyService.svc
https://server.domain.com/MyService.svc
- the call always errors with 404: not found
.My https site is certified using a certificate that was issued by a CA on the corporate domain, and I've verified that I have that CA's certificate installed in Trusted Root Certification Authorities
on the system from which I'm making the calls.
The relevant client code:
Service service = new Service();
service.Url = "http://server.domain.com/MyService.svc";
//service.Url = "https://server.domain.com/MyService.svc";
service.WebMethodCall();
EDIT
Here are the requested portions of the WSDL:
<wsdl:types/>
<wsdl:portType name="IMyService"/>
<wsdl:binding name="BasicHttpBinding_IMyService" type="tns:IMyService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port name="BasicHttpBinding_IMyService"
binding="tns:BasicHttpBinding_IMyService">
<soap:address location="http://server.domain.com/MyService.svc"/>
</wsdl:port>
</wsdl:service>
EDIT
More information:
When I change the serviceMetadata element to have httpGetEnabled="false"
and httpsGetEnabled="true"
the .svc page shows me the following link:
https://boxname.domain.com/MyService.svc?wsdl
rather than the expected
https://server.domain.com/MyService.svc?wsdl
Check that your service element name in the web.config matches the fully qualified named of the class that implements your contract.
<services>
<service name="MyNamespace.MyService">
<endpoint name="MyEndpoint" address="" binding="wsHttpBinding" ...
In your WSDL you see that your service does not expose port on HTTPS but only on HTTP. Moreover you can also see that your service uses BasicHttpBinding (see port name and binding name). That means that your service configuration is not used at all. Check that name in the service element is same as name in your .svc markup. It has to be defined including namespaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With