【发布时间】:2014-08-30 04:58:53
【问题描述】:
我们已经开发了 wcf 服务,当我们从 WCF 测试客户端调用 web 服务来获取数据时,在这种情况下,我们在调用 WCF web 服务时遇到了一些异常。我想将错误记录到 html 文件中。
我的代码:-
try
{
int i = 1;
int j = 0;
int k = i / j;
}
catch (Exception ex)
{
ApplicationError.LogErrors(ex);
}
网络配置:-
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
</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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<remove name="ISAPI-dll"/>
<add name="ISAPI-dll" path="*.dll" verb="*" modules="IsapiModule" scriptProcessor="C:\WINDOWS\System32\inetsrv\asp.dll" resourceType="File" requireAccess="None" allowPathInfo="true" preCondition="bitness64"/>
</handlers>
<directoryBrowse enabled="false"/>
</system.webServer>
错误:-
【问题讨论】:
标签: c# asp.net web-services wcf