我正在使用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" />
答案 0 :(得分:0)
看起来你有一个无限循环,你在endlogin中调用endlogin。