Asynchronous HttpHandlers and WriteAsync

一个人想着一个人 提交于 2019-12-23 18:06:48

问题


I've been experimenting with some code code on Ayende Rahien's blog here which demonstrates using asynchronous HttpHandlers to improve the number of requests that can be processed concurrently.

Unfortunately I can get even the basic example to work. I'm getting the following error:

'System.IO.TextWriter' does not contain a definition for 'WriteAsync' and no extension method 'WriteAsync' accepting a first argument of type 'System.IO.TextWriter' could be found (are you missing a using directive or an assembly reference?)

for the line.

return context.Response.Output.WriteAsync("Hello World!");

I would imagine the method is an extension method added in net4 as part of the Parallel Extensions however for the life of me I can find the correct namespace.

Wouls any of you hardcore csharpers please shed the light.


回答1:


Check out and http://msdn.microsoft.com/en-us/vstudio/async.aspx (under update 1) http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx

Might set you on the right line




回答2:


I've been looking at both Scott Hanselman and Ayende's blog and was scratching my head proper.

My solution was to install the Async CTP and to include a reference to AsyncCtpLibrary which is well hidden in my case C:\Users\Administrator\Documents\Microsoft Visual Studio Async CTP\Samples

Kudos to Missing a reference to AsyncCtpLibrary.dll



来源:https://stackoverflow.com/questions/7390491/asynchronous-httphandlers-and-writeasync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!