WCF service returns 404 over https but not http

前端 未结 4 1943
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 11:49

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

相关标签:
4条回答
  • 2021-01-04 11:52

    HTTP and HTTPS are served from different virtual hosts. Are you sure your service is correctly installed in both?

    0 讨论(0)
  • 2021-01-04 12:00

    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" ...
    
    0 讨论(0)
  • 2021-01-04 12:08

    Thanks to Johann Blais for the answer, I've found out that you would need to include the fully qualified name for the class that defines the service contract.

    For example if your service is

    namespace MyCompany.WcfService
    {
    
        [ServiceContract(Namespace="http://xsd.mycompany.com/mcy/1_0_0")]
        public interface IService
        {
            [OperationContract(IsOneWay = false)]
            void DoStuff()
        }
    
        public class Service : IService
        {
            void DoStuff()
            {
            }
        }
    }
    

    The corresponding service definition in your web.config would be

    <system.serviceModel>
        <services>
            <service name="MyCompany.WcfService.IService">
                <endpoint address="" binding="basicHttpBinding" contract="MyCompany.WcfService.IService" />
            </service>
        </services>
        ...
    </system.serviceModel>
    
    0 讨论(0)
  • 2021-01-04 12:15

    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.

    0 讨论(0)
提交回复
热议问题