English 中文(简体)
每隔一次对异步WCF的调用都很慢
原标题:Every other call to Async WCF is slow

我使用Rick Strahl的这篇文章中的代码示例:http://www.west-wind.com/weblog/posts/324917.aspx对WCF服务进行异步调用,这非常有效。

My problem is this: First call to the WCF Service takes in the vicinity of 20ms, whereas the next takes around 1sec 20ms (doing exactly the same and receiving the exact same data). If I repeat the process the result is the same all the time. Every other call takes one second longer than the first.

我已尝试在服务上设置InstanceContextMode:

  [ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerSession)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public abstract class AjaxPostBack : IAjaxPostBack

我还在服务上调用的方法中设置了计时器,每次的结果都是一样的(当然有一些ms的差异,但没有什么显著性)

"JSON_Took":"00:00:00.0012939","Set_took":"00:00:00.0000274"

(这些值-JSON_Took和Set_Took-是代码隐藏方法中的计时器。所以不是来自客户端-服务器客户端的总时间。这只是为了说明实际代码耗时不是问题)

有什么想法吗?

如果你需要更多信息,请告诉我。

----有趣的更新----

I downloaded IE9 RC and also Firefox (I ve been testing in Chrome) My results from the different browsers:

Firefox:所有通话在约1s 20ms至1s 30ms时保持一致

Chrome浏览器:每隔一个调用都以Firefox的速度启动,其余调用则快1秒

IE9:所有呼叫几乎在任何时间都是一致的(~20ms)

歌剧:与IE9差不多(约30ms)

这是网络工具包的问题吗?(我正在使用$.ajax来调用WCF)

最佳回答

我不会依赖于来自devserver的时间安排。如果将服务部署到IIS(甚至IIS Express),会发生什么情况?VS2010DevServer在时序方面不如服务器可靠,也不会成为生产性能的良好指标。

这是一篇很好的文章(尽管有些过时),讨论IIS和Visual Studio Web Server(又名Cassini)之间的差异。

很高兴这有帮助!

问题回答

暂无回答




相关问题
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. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签