提问人:JustT4ser 提问时间:9/26/2023 更新时间:9/26/2023 访问量:24
如何解决 ASP.NET 中 WCF 服务的超时问题?
How to fix timeout issues with WCF services in ASP.NET?
问:
基本上,我(客户端)正在尝试在 ASP.NET Web 窗体应用程序中实现 WCF Web 服务(使用 HTTPS 配置),并且我基本上已经配置了它,但它不起作用。它仅适用于 SoapUI,并且仅当我添加的 WSS TimeToLive 超过 1000 时。在应用程序中,我收到以下消息:
An error occurred while making the HTTP request to https://webservice.address. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
根据 Web 服务作者给我的规范,我已将安全模式设置为传输,并将其设置为使用用户名和密码。我在SoapUI中设置了相同的设置,除了指定使用传输,因为据我所知,其中没有这样的设置。我还添加了(如上所示)WSS TimeToLive。我在 Google 上能找到的关于它在 .NET 中的等效项就是设置超时。我已将超时设置为多达 10 分钟,但它不起作用。我尝试了所有超时(关闭、打开、接收和发送)更多的是出于绝望。我仍然收到此消息。我还尝试将绑定设置为wsHttpBinding,并按照另一个论坛帖子的建议给出它。这仍然没有奏效。你有什么建议吗?<reliableSession inactivityTimeout="00:10:00"/>
这是我目前的绑定:
var binding = new BasicHttpsBinding()
{
Security = new BasicHttpsSecurity()
{
Mode = BasicHttpsSecurityMode.Transport,
Transport = new HttpTransportSecurity
{
ClientCredentialType = HttpClientCredentialType.None
},
Message = new BasicHttpMessageSecurity
{
ClientCredentialType = BasicHttpMessageCredentialType.UserName,
},
},
CloseTimeout = new TimeSpan(0, 10, 0),
OpenTimeout = new TimeSpan(0, 10, 0),
ReceiveTimeout = new TimeSpan(0, 10, 0),
SendTimeout = new TimeSpan(0, 10, 0)
};
var client = new SISF_to_SIAPortTypeClient(binding,
new EndpointAddress("webservice.address"));
client.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["WebServiceUsername"];
client.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["WebServicePassword"];
return client;
答: 暂无答案
评论