English 中文(简体)
在ASP.NET兼容性/能利用的环境中阻止AJAX后继服务请求的长期服务任务
原标题:AJAX accessible long running service tasks blocking sub-sequent AJAX service requests in an ASP.NET Compatibility/Sessions enabled environment

我有一个问题 被描述和解决在下一条线上

http://blogs.msdn.com/b/silverlightws/archive/2009/09/30/having-a-polling-pollingplus-service-and-anny-other-wcf-servic-servic- in-same-webs-causes-silverlight-calls-to-be-slow.aspx

我使用JavaScript而不是银灯!

POST /PollingWcfServices/ServiceWcf.svc HTTP/1.1
Accept: */*
Content-Length: 564
Content-Type: application/soap+xml; charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0
Host: foo
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=iyr4sf55rm1kypafjdvlhm55

使用以下投票代码

  request.onreadystatechange = function () {
            if (request.readyState == 4) {
                if (request.status == 200)
                    //Process and Poll again
                else
                    //Handle errors
            }

  request.open("POST", url);            
  request.setRequestHeader("Content-Type", "application/soap+xml;charset=utf-8");
  request.send(httpBody);

不幸的是,由于会话设置在 cookie 中, 服务器将尝试按顺序处理相同的会话服务电话 。 这是漫长的民意调查过程的一个大问题 。 一个简单的解决方案是将 Cookie 从信头上移除, 让它看起来像银灯调查, 使用银灯客户堆进行 。

请求.set 请求显示器, 只会附加到页眉值; 这似乎没有什么区别, 因为曲奇似乎被设置在. send 上头 。

唯一解决莫兹利亚问题的办法,

http://www.michael-nol.com/tutorics/cookie-monster-for-xmlhttprequest/" rel="nofollow">http://www.michael-noll.com/tutors/cookie-monster-for-xmlhttps/

request.channel.loadFlags {Ci.nsIrequest.LOAD_ANONYMOUS; 上载Flags {Ci.nsIrequest.LOAD_ANONYMOUS;

虽然它确实删除了ASPXAUTH饼干

是否有人能解决AJAX可进入的长期服务任务,而不阻止AJAX在ASP.NET兼容性/天能环境下提出后继服务请求?

最佳回答

答案在这里...

在.NET 4 中,您可以在应用程序_ beginResources 中做到这一点。

if (Context.Request.Path.EndsWith("xxx.svc")) Context.SetSessionStateBehavior(SessionStateBehavior.ReadOnly);

- < a href="https://stackoverflow.com/ questions/1269198/how-to-force-an-iis-loadd-wcf-or-asmx-webservice-to-uservice-session-object-readon" > 如何强迫由 IS 托管的 WCF 或 ASMX [weservice] 使用只读的会话对象?

通过改变"会合国家行为"的回调服务, 我得以将这项服务分离为非连续运行, 并停止封锁。

感谢Cine (https://stackoverflow.com/uses/264022/cine>)

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签