在IIS 8.5上部署WCF

8

我正在尝试在IIS 8.5上部署一个IIS服务应用程序,但每次我尝试通过 http://localhost/test/WCFService.svc 连接到服务时,都会出现以下屏幕:

enter image description here

当我进入 打开或关闭Windows功能 时,我看到以下内容:

enter image description here

我的web.config内容如下:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name ="MessageServaceBehavior">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" 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="false"/>
        </behavior>
      </serviceBehaviors>

    </behaviors>
    <services>

      <service name ="WCF_Connection.WCFService" behaviorConfiguration="MessageServaceBehavior">

        <host>
          <baseAddresses>
            <add baseAddress="http://10.0.5.32:58632/WCF_Service/"/>
          </baseAddresses>
        </host>
        <endpoint name ="getMessage" address="" binding="basicHttpBinding" contract="WCF_Connection.IWCFService"/>
         <!--<endpoint name ="MessgaeServiceMex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->        

      </service>
    </services>

   <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>

       <!-- To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.-->

    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

什么原因导致这个问题出现,我该如何解决?

尝试安装Internet信息服务和可托管Web Core的所有功能,然后将您的网站复制到wwwroot文件夹中。 - Feras Salim
1个回答

11
你可能缺少WCF HTTP激活功能。它位于Windows功能屏幕的不同部分(请查看下面的屏幕截图),据我所知,在安装IIS时默认情况下不启用该功能。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接