Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# web服务访问包装器_C#_Web Services_Timeout - Fatal编程技术网

C# 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

嗨,我必须在我的解决方案中使用web服务 我有一个包装器静态类访问web服务

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服务检查用户状态,我想添加代码来控制这项业务