https不适用于虚拟目录

时间:2014-04-10 08:09:43

标签: c# wcf ssl iis-7 virtual-directory

我为我的网站https://www.test.com配置了SSL。我有一个虚拟的顽固性testwcf。当我用https://www.test.com/testwcf/Common.svc访问它时。显示消息You have created a service.但是当我访问服务中的任何方法时,例如 https://www.test.com/testwcf/Common.svc/select?id=1我收到错误The resource cannot be found.。但它适用于http即http://www.test.com/testwcf/Common.svc/select?id=1。任何人都可以帮我解决这个问题。我在网上搜索很多,但对我来说没什么用呢

下面是我的websconfg

<services>

     <service name="testwcf.Service1">
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="secureHttpBinding"
              contract="testwcf.IService1"/>

    <endpoint address="mex"
              binding="mexHttpsBinding"
              contract="IMetadataExchange" />
  </service>
    </services>
    <bindings>
  <basicHttpBinding>
    <binding name="secureHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
  </system.serviceModel>

1 个答案:

答案 0 :(得分:0)

您需要更新服务的绑定才能使用传输安全性。添加安全绑定,如:

<bindings>
  <basicHttpBinding>
    <binding name="secureHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

然后更改您的服务配置以使用该绑定。

<services>
  <service name="MySecureWCFService.Service1">
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="secureHttpBinding"
              contract="MySecureWCFService.IService1"/>

    <endpoint address="mex"
              binding="mexHttpsBinding"
              contract="IMetadataExchange" />
  </service>
</services>

http://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx

的更多信息