开发者

How to create a WCF reply service for AJAX unit testing

I want to create a WCF service that will simply reply back the query string, HTTP headers, and the HTTP verb used in a request it received.

I want to use it to unittest a AJAX enabled JavaScript framework I am building so I 开发者_如何学Pythoncan verify that the HTTP headers and HTTP verbs are being set correctly.

Basically I need a way to make the WCF service bind to HTTP GET, POST, PUT, and DELETE, and I need a way to grab all the headers etc. and return them.

Any input is much appreciated, Egil.


Not sure that it is possible to do exactly what you want to do. But you could come close using REST with WCF, see http://msdn.microsoft.com/en-us/netframework/cc950529.aspx


It turns out a HTTP handler was an easier way to go than a WCF service. I posted my solution over at my blog: Simple Ping/Reply Service for Unit Testing AJAX/XHR requests. I hope this helps others as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜