October 2011 - Posts

"View in browser" context menu


Some time ago I've presented the support of IIS (local and Express) in SharpDevelop where one can set the web server options (Project Properties/Debug tab/Web server)

Now, I'd like to present you a new context menu item called "View in browser". When creating a web project (ASP.NET Web Forms / MVC) or a web service (ASP.NET WS, WCF - SOAP or REST), SharpDevelop will generate some basic files to get you started. Depending on the type of project, you will have some aspx, asmx, svc etc. files. The context menu for these types of files (aspx,asmx,html,htm,svc), will contain the new menu option:

When executing this option, SharpDevelop will verify if the current project is a web project/service, create the virtual directory/application and start it in a browser (default port is set to 8080).

If you have IIS Express installed, SharpDevelop will execute it for you also. As expected, debugging will work too.

If you want to edit/remove the registered websites in IISExpress, you will have to go to ''%userprofile%\documents\IISExpress\config\applicationhost.config" and edit/remove the "configuration/system.applicationHost/sites/site" element.

TODO list:

  • port collision
My test environment: 
  • Windows 7 Ultimate 32bit
  • SharpDevelop 4.2 (master branch)
  • IIS Express and IIS 7.5 (from Windows 7).
If you switch between IIS Express and local IIS, don't forget to restart your computer, register ASP.NET (aspnet_regiis.exe /i) and restart IIS (iisreset).
Happy coding! 
Posted by Eusebiu | 1 comment(s)