我正在研究WCF,它在localhost上运行良好.将其放在生产服务器上后,它会产生异常
无法激活所请求的服务" http://global-kazway.kz/Service1.svc ".有关更多信息,请参阅服务器的诊断跟踪日志
我是服务新手,已经尝试解决这个问题将近3个小时.
这是App.config客户的;
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections></configSections>
<connectionStrings>
<add name="TestProject.Properties.Settings.DBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\1\Documents\visual studio 2010\Projects\TestProject\TestProject\AppData\DB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /><add name="DBEntities" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=C:\Users\1\Documents\visual studio 2010\Projects\TestProject\TestProject\AppData\DB.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /><add name="DBEntities1" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\AppData\DB.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" 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://global-kazway.kz/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="kazwayServiceReference.IService1"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)
SAS*_*ter 70
对WCF应用程序进行故障排除的第一步是打开浏览器并输入服务URI.因此,基于客户端:您将导航到http://global-kazway.kz/Service1.svc
现在看看你得到了什么样的结果.例外?服务屏幕?通常,您可以从此屏幕获取最佳信息!有时它指出你的问题是什么,比如错过了一个行为.
将web.config与已部署的web.config条目进行比较.你也可以找到一些东西.最后,您可能只需要管理文件夹的安全性.但浏览器显示可以非常清楚地为您拼出所有内容.
小智 8
我正在做一个项目,我遇到了同样的问题.当我检查事件查看器以跟踪错误时,我发现了问题所在.
事件查看器消息:
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/7540993
Exception: System.ServiceModel.ServiceActivationException: The service '/CODWebService/Service1.svc' cannot be activated due to an exception during compilation. The exception message is: Memory gates checking failed because the free memory (164065280 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.. ---> System.InsufficientMemoryException: Memory gates checking failed because the free memory (164065280 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
Run Code Online (Sandbox Code Playgroud)
然后我将以下代码添加到我的服务的web.config文件中.
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="1" />
Run Code Online (Sandbox Code Playgroud)
该元素应放入 <system.serviceModel>
我在WCF上工作,并且在localhost上运行良好。将其放置到生产服务器后,它发出一个异常“请求的服务'http://global-kazway.kz/Service1.svc'激活。请参见服务器的诊断跟踪日志的详细信息 “
此MSDN本文介绍如何在服务器上配置跟踪。完成后,您可以查看服务器的诊断跟踪日志,很可能会发现问题。
| 归档时间: |
|
| 查看次数: |
69656 次 |
| 最近记录: |