我正在开发一个使用托管在不同应用程序池中的 WCF 服务的网站,每次 WCF 服务的应用程序池回收时,我在使用该网站时都会收到 503:
[WebException: The remote server returned an error: (503) Server Unavailable.]
System.Net.HttpWebRequest.GetResponse() +6440728
System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +55
[ServerTooBusyException: The HTTP service located at http://cr.genesis.dev/Genesis/RepositoryService.svc is unavailable. This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later.]
...
当我尝试直接在我的网络浏览器中访问该服务时,它第一次给了我一个 503,但之后它就起作用了(大概是它导致应用程序启动?)我想知道为什么网站没有唤醒Web 服务 - 即使我尝试多次加载页面,我仍然会收到 503...
如果这有什么不同,我将使用 Windsor WCF 集成,将 LifestylePerWebRequest 用于我的客户端,将 LifestylePerThread 用于我的服务。
这是我的服务配置:
<system.serviceModel>
<services>
<service name="Genesis.Repository.Service.RepositoryService" behaviorConfiguration="repositoryServiceBehaviour">
<host>
<baseAddresses>
<add baseAddress="http://cr.genesis.dev/Genesis/" />
</baseAddresses>
</host>
<endpoint name="basicHttpBinding"
address="RepositoryService.svc"
binding="basicHttpBinding"
contract="Genesis.Repository.Service.IRepositoryService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="repositoryServiceBehaviour">
<!-- 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" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
和客户:
<system.serviceModel>
<client>
<endpoint name="basicHttpBinding"
address="http://cr.genesis.dev/Genesis/RepositoryService.svc"
binding="basicHttpBinding"
contract="Genesis.Repository.Service.IRepositoryService" />
</client>
</system.serviceModel>
任何建议,将不胜感激!