私が必要としているのは、SL アプリと Ria サービスの間の接続を維持することです。タイムアウトが経過すると、最初のサービス呼び出しで例外がスローされます。
私がやろうとしたことは、定期的に呼び出すことです:
var client = new WebClient();
client.DownloadStringAsync(new Uri("../SomePage.aspx", UriKind.Relative));
およびサービスメソッド:
svc.HeartBeat();
定期的にというのは、X < タイムアウトである X 秒ごとに 1 回という意味です。
ハートビートと認証の間の 60 秒の遅延を次のように設定してテストしていました。
<authentication mode="Forms">
<forms timeout="2" slidingExpiration="true" />
</authentication>
とにかく、3分後に私は得る:
Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ServiceModel.DomainServices.Client.DomainOperationException: Invoke operation 'HeartBeat' failed. Access to operation 'HeartBeat' was denied.
w System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
w System.ServiceModel.DomainServices.Client.InvokeOperation.Complete(Exception error)
w System.ServiceModel.DomainServices.Client.DomainContext.CompleteInvoke(IAsyncResult asyncResult)
w System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass38.<InvokeOperation>b__34(Object )
と
HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/11.0.0.0
Date: Mon, 16 Sep 2013 09:46:37 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 5108
Connection: Close
[Exception: Access denied.]
Pol.Backend.Web.SystemMessageViewer.Page_Load(Object sender, EventArgs e) in c:\Users\xyz\Documents\Visual Studio\Abc.Web\SomePage.aspx.cs:13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
( Access denied は次の場合にスローされます:
if (this.User == null || !this.User.Identity.IsAuthenticated)
{
throw new Exception("Access denied.");
}
)
他に何ができますか?