gpt4 book ai didi

c# - 调用ASP.NET页面的WCF方法OnUnload

转载 作者:行者123 更新时间:2023-11-30 18:23:01 24 4
gpt4 key购买 nike

我想在应用程序退出时调用 WCF 方法,但是,当我尝试使用此代码运行 ASP.NET 应用程序时:

protected override void OnUnload(EventArgs e)
{
base.OnUnload(e);

MaChatServer.Service1Client proxy = new MaChatServer.Service1Client();
proxy.RemoveUser(UsernameStatic);
if (proxy.GetAllUsers().Count == 0)
{
proxy.ResetServer();
}
}

我看到这个错误页面:

Description: An unhandled exception occurred during the execution of the current web request. For more information about the error and where it originated in the code, refer to the stack trace. Exception Details: System.ServiceModel.FaultException: The server was unable to process the request two to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.

最佳答案

首先我建议您将配置添加到您的主机 wcf 服务 (.config)

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

因为您没有确切的错误信息,您的信息必须发送给您的客户

关于c# - 调用ASP.NET页面的WCF方法OnUnload,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32908284/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com