簡體   English   中英

在IIS中部署WCF服務錯誤-“本地主機當前無法處理此請求”

[英]Deploy WCF service in IIS error - “localhost is currently unable to handle this request”

我有一個正在嘗試在IIS中部署的WCF service.svc。 我使用.net 4.5應用程序池在默認網站下為該服務創建了一個IIS應用程序,但是當我嘗試從IIS管理器中瀏覽.svc文件時,瀏覽器報告以下錯誤“本地主機當前無法處理這個請求”。

如果我單擊從VS中的.svc文件瀏覽,它將正確解析到WSDL元數據頁面,並且如果我使用服務文件夾所在的Visual Studio中的路徑創建IIS應用程序,它將起作用並且URL解析。 我不明白為什么將服務發布到另一個在IIS中不起作用的文件夾位置后的原因。 似乎與Visual Studio的安裝位置有關。

有人可以幫我理解為什么嗎? 我需要能夠將此服務連同關聯的bin文件一起發布到另一個客戶端系統,並使其正常工作。

Web.config文件:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
      </startup>
      <appSettings>
      </appSettings>

      <system.serviceModel>
        <client/>
        <bindings>
          <basicHttpBinding>
            <binding name="basicHttpBinding_testLink" maxReceivedMessageSize="20000000"/>
          </basicHttpBinding>
        </bindings>

        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- 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>

        <!-- Service endpoints to expose/consume -->
        <services>
          <service name="testLink.testManager">

            <endpoint address="testService" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_testLink" contract="testLink.ITestManager"/>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"  />

          </service>
        </services>

        <protocolMapping>
          <add binding="basicHttpBinding" scheme="http"/>
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>

      </system.serviceModel>

    </configuration>

由於沒有人可以回答此問題,因此我自己更深入地解決了該問題,發現當您將IIS WCF服務發布為已發布的文件系統時,需要將已發布的文件夾放置在inetpub / wwwroot文件夾中,以供IIS管理器使用。使用否則將無法正確部署和解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM