在HTTPS上托管的Web应用程序中的WCF服务

时间:2013-04-17 06:51:24

标签: asp.net wcf https

我在HTTPS上运行生产(.NET 4.0,IIS 7.0)的现有ASP.NET Web应用程序(我们称之为https://myapp.com)。现在需要向应用程序添加新的WCF服务,该服务将由位于不同服务器上的桌面应用程序使用。这就是我所做的:

  1. 在我现有项目的目录/ WebServices中添加一个新的WCF服务(名为myService.svc)(在localhost上正常工作)。
  2. 照常发布网站。
  3. web.config中配置我的网络服务,如下所示:
  4. 配置:

    <system.serviceModel>
      <bindings>
        <basicHttpBinding>
          <binding name="TransportSecurity">
            <security mode="Transport">
              <transport clientCredentialType="None"/>
            </security>
          </binding>
        </basicHttpBinding>
      </bindings>
    
      <services>
        <service name="myService" behaviorConfiguration="myBehavior">
          <endpoint address="https://myapp.com/Webservices/myService.svc" binding="basicHttpBinding"
             bindingConfiguration="TransportSecurity" contract="myService"/>
          <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
        </service>
      </services>
    
      <behaviors>
        <serviceBehaviors>
          <behavior name="myBehavior">
            <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="false" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    

    在我看来,我已经做了所有必要的事情。当我在浏览器中运行URL https://myapp.com/WebServices/myService.svc时,我得到'资源未找到'。为了仔细检查,我创建了一个测试控制台应用程序并尝试使用相同的URL“添加服务引用”,但它无法发现它。

    我做错了什么?我是WCF的新手,并且长期坚持这个问题。

0 个答案:

没有答案
相关问题