Simon on the (dot)Net

L'homme qui codait en do dièse

  Home :: Contact :: Syndication  :: Login
  29 Posts :: 0 Stories :: 0 Comments :: 0 Trackbacks

News

Archives

Image Galleries

jeudi 31 mai 2007 #

As you can see with my previous article, I am a Script# enthusiast. But there are some limitations in the actual version. One of the most important examples is the lack of support for ASP.NET Ajax proxies for WEB Services.

Indeed, ASP.NET Ajax generates JavaScript proxy classes allowing browser-side code to call ASP.NET WEB Services methods marked as [ScriptService] and [ScriptMethod].

As Script# does not allow to write code calling classes and methods that it does not know, we have to build Script# assemblies that contain stubs of the proxy classes generated by ASP.NET Ajax. In order to do that, we need to look at the JS code generated by ASP.NET Ajax and rewrite the declarations in C#. It is a very time-expensive process, so I decided to create a Visual Studio plug-in that do that automatically.

It works using reflection on your WEB Application assembly, looking for [ScriptService]-marked WEB Services and [ScriptMethod]-marked methods, generating C# code and compiling it with Script#.

You can download this add-in here, and its source code here.

To use it, build your WEB Application project, right click on it in Solution Explorer and click “Generate Script# stubs for Web Services…” Chose a path to store the generated assembly, click OK, and that is done.

PS: this add-in only works with WEB Application project template (not with Web site templates).

[updated]:

I have just made a video presenting this: http://blogs.labo-dotnet.com/simon/archive/2007/06/08/17379.aspx

posted @ 11:27 | Feedback (49)