简体   繁体   中英

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. 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".

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. I don't understand why after I publish the service to another folder location that it doesn't work in IIS. Somehow it seems tied to Visual Studio installed location.

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.

Web.config file:

    <?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管理器使用。使用否则将无法正确部署和解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM