2

I am a php/python programmer with a good basic understanding of .NET and visual studio. I have been asked to look at a bug in an ASP.NET application at work (dev has left), but I don't understand why it won't allow me to debug the application?

The application will build fine with zero errors or warnings.

my web.config has:

<configuration>
...
  <system.web>
  ...
    <compilation debug="true" targetFramework="4.5">

and in the solution properties, the ASP.NET debugger is ticked. So far I have been following this msdn article, and Solution properties > Web > Servers shows 'Use Visual Studio Development Server' and 'auto-assign port' are both ticked/active.

However when I attempt to debug the application, I get "page cannot be displayed". I have unticked "show friendly HTTP error messages" in IE, and all I get in return is:

This page can’t be displayed

•Make sure that the web address http://localhost:52566 is correct.

•Look for the page with your search engine.

•Refresh the page in a few minutes.

I'm not sure what else to check, and so far everything I've found on Google seems to deal with debugging on remote servers or IIS etc, but I'm only using the built-in dev server?

Morrolan
  • 77
  • 2
  • 9
  • How are you trying to debug? When I debug an ASP.NET page and I let it sit on a breakpoint in the debugger, the browser will eventually time out and display that message. – Mr Lister Nov 23 '15 at 16:02
  • I have breakpoints set, but when IE opens (I have also tried Firefox and Chrome), when I specify the page I want to debug (http://localhost:52566/Views/Overview/Overview_LiveCasesbyInsolvencyCaseType.cshtml in this case), I still simply get "This page can't be displayed". – Morrolan Nov 23 '15 at 16:06
  • Have you checked your 'event viewer' for any exceptions ? – UnitStack Nov 23 '15 at 16:10
  • @Diginari I think you may be onoto something - event viewer shows the following warning: Exception type: HttpExceptionException message: Path '/Views/Overview`/Overview_LiveCasesbyInsolvencyCaseType.cshtml' is forbidden. at System.Web.HttpForbiddenHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) – Morrolan Nov 23 '15 at 16:13
  • Sounds like an application pool issue. Are you using a local IIS? Also make sure correct version of asp.net is selected – UnitStack Nov 23 '15 at 16:17
  • I'm not using local IIS, I am using built-in VS Development Web Server. How can be sure of using the correct version of ASP? – Morrolan Nov 23 '15 at 16:20
  • I have come across another issue which could be the cause - when I restarted my machine and VS, I got: `The Web project 'MyProjectName' requires missing web components to run with Visual Studio. Would you like to download and install them using the Web Platform Installer now? (Note: Some components might requre a restart to take effect.) ASP.NET Web pages with Razor syntax 3.0.0.0.` – Morrolan Nov 23 '15 at 16:46

2 Answers2

1

Try to access a page.. Example - Default.aspx Example-- http://localhost:52566/Default.aspx

Set a start page for your web application by right clicking on a page in your solution and clicking set as start page.

0

I've had a similar issue where I had to run VS as administrator if i was using an impersonator user.

Falanor
  • 206
  • 1
  • 9
  • I have just tried running VS and the solution as the administrator, but no difference unfortunately. – Morrolan Nov 23 '15 at 16:11
  • Okay this is another unorthodox solution to try and attempt to track the problem down. I wouldn't leave it this way but try to set the security on the project folder to full control for everyone. I've seen issues where the IISExpress fake app pool user doesn't have permission to access the site folder. Additionally you could try to debug in IIS directly if you have it available. – Falanor Nov 23 '15 at 16:19
  • I hav ejust tried this, given full control to everyone but still no luck. – Morrolan Nov 23 '15 at 16:23
  • Try to add this to the system.webserver config section and see if it gives you anything different ` ` – Falanor Nov 23 '15 at 16:26
  • What does your default page situation on this project look like? – Falanor Nov 23 '15 at 16:28
  • If I understand your question correctly, you asked what default page/start page I have configured? I have tried with many with the same result. I have added those 2 lines, built and debugged my application, with the same result, therefore I can only assume that for some reason VS isn't serving the pages/site properly at all. – Morrolan Nov 23 '15 at 16:32
  • I'm going to assume running this as release or debug makes no difference either way. Can you try to create new web project and see if you can get that to debug? – Falanor Nov 23 '15 at 16:46
  • Good call - when I tried to create a new ASP web forms application, I received: Configuring Web http://localhost:53546/ for ASP.NET 4.5 failed. You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly. – Morrolan Nov 23 '15 at 16:58
  • I'd say one of 2 things at this point. You need to run this from the visual studio command line.`aspnet_regiis -i` Or you need to repair your .net install. This might point you in the right direction if that doesn't work. http://stackoverflow.com/questions/5836228/asp-net-4-0-has-not-been-registered – Falanor Nov 23 '15 at 17:01
  • OK, that was a known issue and is fixed by: https://support.microsoft.com/en-us/kb/3002339. Short version is I can now debug a new application, but not the one I need. However, I don't understand why it is complaining about ASP.NET 3.0.0.0 when I have ASP.NET 3.3.0.0 installed? – Morrolan Nov 23 '15 at 17:04
  • Maybe try deleting (or even just rename) the applicationHost.config under "My Documents\IISExpress\config". Couple of other things to check. Is this a forms or windows auth site? Is https involved anywhere? – Falanor Nov 23 '15 at 18:12