C# web服务访问包装器
嗨,我必须在我的解决方案中使用web服务 我有一个包装器静态类访问web服务C# web服务访问包装器,c#,web-services,timeout,C#,Web Services,Timeout,嗨,我必须在我的解决方案中使用web服务 我有一个包装器静态类访问web服务 public static class Authentication { public static bool VerifyPassword(int membershipID, string password) { PCIValidationResult result = CreatePciWebService().ValidatePassword( m
public static class Authentication
{
public static bool VerifyPassword(int membershipID, string password)
{
PCIValidationResult result = CreatePciWebService().ValidatePassword(
membershipID, password);
LoginValidationResult loginValidationResult =
(LoginValidationResult)Enum.ToObject(
typeof(LoginValidationResult), result.ResultCode);
return true;
}
private static PCIWebService CreatePciWebService()
{
PCIWebService service = new PCIWebService();
service.Url = KioskManagerConfiguration.PciServiceUrl;
return service;
}
我用代码调用这个类
像
第一次调用代码成功,第二次调用代码成功
我在2-3分钟后得到“操作超时”。等待
如何调用web服务?除了总是返回true,并且可能使用
using
(如果服务是IDisposable
),我看不出任何明显的错误
您是否尝试过使用fiddler或wireshark跟踪它,以了解在传输级别发生了什么
您可以尝试使用添加,但尽管这可能会使事情变得整洁,但我不确定它是否能解决此问题:
using(PCIWebService svc = CreatePciWebService()) {
PCIValidationResult result = svc.ValidatePassword(membershipID, password);
//...etc
}
除了总是返回true,并且可能使用using
(如果服务是IDisposable
),我看不出任何明显的错误
您是否尝试过使用fiddler或wireshark跟踪它,以了解在传输级别发生了什么
您可以尝试使用
添加,但尽管这可能会使事情变得整洁,但我不确定它是否能解决此问题:
using(PCIWebService svc = CreatePciWebService()) {
PCIValidationResult result = svc.ValidatePassword(membershipID, password);
//...etc
}
你的意思是返回基于loginValidationResult的内容,而不是每次都返回true吗?嗨,marc,首先感谢你的快速回复,loginValidationResult不是问题的一部分,访问Web服务并检查用户状态我想添加代码来控制此业务您是想返回基于loginValidationResult的内容,而不是每次都返回true吗?嗨,marc,首先感谢您的快速回复,loginValidationResult不是问题的一部分,通过Web服务检查用户状态,我想添加代码来控制这项业务