【问题标题】:web service accessing wrapperWeb 服务访问包装器
【发布时间】:2010-11-03 05:55:14
【问题描述】:

您好,我必须在我的解决方案中使用 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;
    }

我在代码中调用这个类 喜欢

Authentication.VerifyPassword(23,"testUser");

第一次调用代码成功第二次调用代码后 2-3 分钟后,我得到“操作已超时”。等待...

如何调用网络服务?

【问题讨论】:

  • 你的意思是根据loginValidationResult返回一些东西,而不是每次都返回true?
  • 嗨,马克,首先感谢您的快速回复,loginValidationResult 不是问题的一部分,请通过 webService 并检查用户状态,我要添加代码来控制此业务

标签: c# web-services timeout


【解决方案1】:

除了总是返回 true,并且可能使用using(如果服务是IDisposable),我看不出有什么明显的错误。

您是否尝试过使用 fiddler 或 wireshark 对其进行跟踪以查看传输级别发生了什么?

您可以尝试添加using,但虽然这可能会整理好东西,但我不确定它是否能解决此问题:

using(PCIWebService svc = CreatePciWebService()) {
    PCIValidationResult result = svc.ValidatePassword(membershipID, password);
    //...etc
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-14
    • 1970-01-01
    • 1970-01-01
    • 2013-03-12
    • 1970-01-01
    相关资源
    最近更新 更多