我需要的是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
( 在以下情况下抛出拒绝访问:
if (this.User == null || !this.User.Identity.IsAuthenticated)
{
throw new Exception("Access denied.");
}
)
我还能做什么?