URL rewrite rule not working in Visual Studio Development Server

asp.neturl-rewritingvisual studio 2010

How can I troubleshoot url rewrite rules that are not working in my Visual Studio 2010 Development environment?

I am enhancing an existing ASP.NET application.

My issue is the URL rewrite rules written in web.config do not work in my Visual Studio 2010 development environment. It only works after deploying the project to IIS.

I need to debug the project as I am not familiar with how it is designed and developed. It is too big a project.

If rewrite won't work in the Visual Studio Development Server, is there a workaround? I really need to work on the project in debug mode. Every time it takes me to a custom error page.

Best Answer

You can always debug into your local IIS. There are 3 approaches:

  • You should be able to do this seamlessly if your project is configured to deploy to the local IIS web server - just hit F5. It should deploy then attach.
  • After you deploy, browse to the local site, then attach to the running site by using "Debug, Attach to Process, w3wp.exe".
  • Add System.Diagnostics.Debugger.Break() to the line on which you want to break your code, deploy to IIS, then run. A "start debugging" dialog should appear when the line is hit.