简体   繁体   English

在IIS中部署WCF服务错误-“本地主机当前无法处理此请求”

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

I have a WCF service.svc that I'm trying to deploy in IIS. 我有一个正在尝试在IIS中部署的WCF service.svc。 I created an IIS application under the Default Web Site for the service using the .net 4.5 application pool, but when I try to browse the .svc file from within the IIS manager, the browser reports the following error "localhost is currently unable to handle this request". 我使用.net 4.5应用程序池在默认网站下为该服务创建了一个IIS应用程序,但是当我尝试从IIS管理器中浏览.svc文件时,浏览器报告以下错误“本地主机当前无法处理这个请求”。

If I click browse on the .svc file from within VS it resolves correctly to the WSDL metadata page and if I create an IIS application using the path in Visual Studio where the service folder resides it works and the url resolves. 如果我单击从VS中的.svc文件浏览,它将正确解析到WSDL元数据页面,并且如果我使用服务文件夹所在的Visual Studio中的路径创建IIS应用程序,它将起作用并且URL解析。 I don't understand why after I publish the service to another folder location that it doesn't work in IIS. 我不明白为什么将服务发布到另一个在IIS中不起作用的文件夹位置后的原因。 Somehow it seems tied to Visual Studio installed location. 似乎与Visual Studio的安装位置有关。

Can someone help me understand why this is? 有人可以帮我理解为什么吗? I need to be able to publish this service along w/ the associated bin files to another client system and have it work. 我需要能够将此服务连同关联的bin文件一起发布到另一个客户端系统,并使其正常工作。

Web.config file: 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