GWT is primarily used in the Java world for obvious reasons: apart from being an excellent tool for creating RIAs (indeed it's my favorite one), it allows to develop both the server and the client part using a single language and a single IDE, and it even allows to share classes.

But GWT can be used with any server technology, and although those advantages do not apply anymore, it is an alternative that deserves serious consideration from developers of any server platform. I happen to be a GWT fan that works in a company that uses Microsoft products, so it seems obvious to me to try to combine both. After all, should we use Flex for example, we would still need to use two languages and two IDEs, so who cares. Same applies to all JavaScript toolkits and frameworks (please don't tell me that Visual Studio is a good JavaScript IDE: it even misses matching braces highlighting).

The main issue with an ASP.NET+GWT setup (as for any non-Java server part) is that one must run two servers while writing the application, for example the GWT development server and the ASP.NET development server. And when GWT makes a request to the server, it can only call the GWT server, due to the same origin policy that restricts JavaScript connections. That restriction does not apply to the compiled GWT code, that is pure JavaScript served by the ASP.NET server. But the GWT dev mode is essential, so a proxy is needed to redirect all requests to the ASP.NET server. After that proxy is in place, the setup works well, and since the server is outside GWT, you never need to restart the embedded Jetty (changes to server classes will trigger a restart of the ASP.NET server as usual).

Unfortunately, there's no easy solution to class sharing between ASP.NET and GWT, although it should be quite easy to write a code generator that creates POCOs and POJOs with the same properties and keep them synchronized. Alternatively, JSON can be used to transfer data.

I created a simple project that can be used as skeleton to develop an ASP.NET application that uses GWT. It is not limited to GWT, since regular Web Forms can be used too. After all, GWT is just JavaScript, so any combination will work. The project contains a proxy servlet, that can be used with any server, not only with ASP.NET. This project can be run using Visual Studio for the ASP.NET part and Ant, Eclipse or NetBeans for the Java part.

In Visual Studio, open the PROJECT_HOME/war as a web site. In Eclipse, import the whole project (you must install the Google Plugin for Eclipse).

To use Ant or NetBeans, download the GWT SDK and unpack it into a "gwt" folder inside the project, so that its JARS are available at PROJECT_HOME/gwt/*.jar. If you have GWT elsewhere, customize build.xml or the NetBeans project to adjust paths accordingly.

Before starting the GWT development mode, start the ASP.NET development server and modify web.xml to match your setup (you can also use IIS). Then run the development mode and connect to:

Let me highlight some features of this setup:

Let me know if this setup works for you. I'll show it to my colleagues and I hope to convince them to use GWT in some serious application. There is a project that should be start soon and that would be a perfect chance, and that's why I explored this opportunity.