0

我正在开发 WPF 应用程序并使用 MVVM。我正在使用异步方法调用 WCF 服务,它阻塞了 UI。有时它只是完全超时。我的网站使用相同的服务(但不使用异步调用)没有问题。这是我的代码和客户端配置。

    private void ProcessLogin()
    {
        if (Username == null || Password == null)
            return;

        _working = true;
        CommandManager.InvalidateRequerySuggested();
        Status = "Authenticating User";

        _authClient.BeginLogin(Username, Password, "", false, EndLogin, null);
    }

    protected void EndLogin(IAsyncResult asyncResult)
    {
        LoggedIn = _authClient.EndLogin(asyncResult);

        if (!LoggedIn)
        {
            Status = "Authentication Failure";
        }
        else
        {
            DialogResult = true;
        }
        _working = false;
        CommandManager.InvalidateRequerySuggested();
    }
<basicHttpBinding>
    <binding name="BasicHttpBinding_AuthenticationService" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
    </binding>
</basicHttpBinding>

<endpoint address="https://path_to_service:444/Authentication.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AuthenticationService"
            contract="AuthService.AuthenticationService" name="BasicHttpBinding_AuthenticationService" />
4

1 回答 1

0

看起来您有一个无限循环,您正在从 endlogin 中调用 endlogin。

于 2012-05-16T21:59:09.113 回答