服务不可用 503 + 位于 http://localhost/ProductsService/Service.svc 的HTTP服务过于繁忙。

12

你好,我一直在尝试解决我的问题,但是一直无法解决。

问题是:

http://localhost/productservice/service.svc 当我在浏览器中键入此地址时,会出现503服务不可用的错误。

当我从VS 2010运行我的代码时,它给了我:

  

位于http://localhost/ProductsService/Service.svc的HTTP服务太忙了。异常。

ProductService在ASP.NET v4.0集成应用程序池中以ApplicationPoolIdentity身份运行。

我不知道我需要做什么!

(Windows 7 Home&IIS7)

使用basicHttpBinding

服务器端配置为:

<?xml version="1.0"?>
<configuration>
    <connectionStrings>
        <add name="AdventureWorksEntities" connectionString="metadata=res://*/ProductsModel.csdl|res://*/ProductsModel.ssdl|res://*/ProductsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=PINCHY\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
    </connectionStrings>
    <system.web>
        <compilation debug="true" targetFramework="4.0">
            <assemblies>
                <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            </assemblies>
        </compilation>
    </system.web>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                    <serviceMetadata httpGetEnabled="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>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

客户端的 app.config 是:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IProductsService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:80/ProductsService/Service.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProductsService"
                contract="ProductsService.IProductsService" name="BasicHttpBinding_IProductsService" />
        </client>
    </system.serviceModel>
</configuration>

非常感谢任何帮助


2
你需要提供更多信息!你的配置是什么?你使用了哪种绑定?给我们展示服务器端的配置!(任何在<system.serviceModel>标签内的内容) - marc_s
你的配置看起来正确。你尝试过调试你的服务吗?顺便问一下,Windows 7 Home 有IIS7吗? - Ladislav Mrnka
我使用了Microsoft Service Trace Viewer!我能看到的是System.ServiceModel.ServerTooBusyException,System.ServiceModel,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089。是的,Windows 7 Home有IIS 7.5,你认为我在这里漏掉了什么吗?在我遇到这个异常之后,应用程序池停止工作,我必须重新启动它。 - Pinchy
无论我尝试了什么,都无法使其正常工作!我不得不完全卸载并安装ISS 7.5、.Net V4.0框架。现在它可以正常工作了。我猜测这是.Net 4与IIS 7.5的兼容性问题,感谢您的帮助 :) 干杯! - Pinchy
5个回答

22

我遇到了相同的问题,但原因不同。在 IIS(左侧面板)中,点击“应用程序池”,确保你选择的 ASP.NET 版本实际上已经运行。我的情况是由于某种原因没有运行。


1
我的应用程序池关闭了,因为我们的COTS CRM系统认为关闭它是个好主意。 - Bruno

8

我也遇到了同样的问题。对我来说,问题是无效密码。我的密码最近更改了,而IIS应用程序池仍然使用旧密码。一旦更新了密码,应用程序就可以正常工作了。

希望这能帮到你。


谢谢Nam!看起来运行应用程序池和站点的帐户密码已更改。重置并执行了停止/启动操作,VS中没有构建或打包错误。 - sealz

3
我也遇到了同样的问题,解决方法如下:
在 IIS 中,点击默认网站下的 ProductsService 网站。在右侧的操作面板中,单击高级设置。检查启用协议属性,该属性的值应使用逗号分隔,例如:http, net.tcp。实际上,我曾经输入了分号而不是逗号,结果出现了与您面临的相同异常。请尝试将分号替换为逗号,我认为这应该可以解决问题。

2
我们的团队遇到了相同的问题,503服务不可用。 在我们的情况下,应用程序池很好,(身份设置正确,应用程序池已启动)。
经过一些评估,我们发现安装在服务器上的一个基于WCF的服务保留了80端口。使用netsh http命令,我们能够看到URL保留。
netsh http show urlacl

Reserved URL            : http://+:80/

以下链接对解决“503服务不可用”错误很有帮助: http://blogs.msdn.com/b/webtopics/archive/2010/02/17/a-not-so-common-root-cause-for-503-service-unavailable.aspx

谢谢。我的情况也是一样,但是是在使用https - 443时出现的。删除后它就可以工作了。 - gdenuf
死链接,存档于archive.org: https://web.archive.org/web/20190122182217/https://blogs.msdn.microsoft.com/webtopics/2010/02/17/a-not-so-common-root-cause-for-503-service-unavailable/ - tr00st

1
我在本地运行一个.NET 4.0网站时,在IIS 7中一直遇到503错误。我对此感到相当自负,因为我所要做的就是在左侧窗格中单击"应用程序池",其中列出了站点和应用程序池。果然,相关的应用程序池总是停止的,我只需重新启动它。然而,今天(我回到这个问题的原因)这并没有解决问题。在我的情况下,我有一个有一些公共页面的网站,然后有2个受密码保护的应用程序。只有其中一个应用程序会出现503错误。我选择该应用程序,单击"高级设置",发现问题是应用程序池。它指向的是默认应用程序池,而不是整个网站的应用程序池。当我纠正了这个问题之后,网站的所有3个区域都恢复正常工作了。因此,总结一下,503错误可能是由于应用程序池停止导致的。只需确保重新启动正确的应用程序池即可使您的网站再次运行。

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