Why does "start debugging" cause an immediate HTTP404 error? - asp.net

Setup
I recently changed computers, and pulled down a codebase that had been working before. I created the application using the "Create Virtual Directory" button in Visual Studio, and I can confirm that the application shows up in IIS as an application. I know this codebase works because it's in production; I've just changed development environments.
The Problem: HTTP 404.0
When I run the application, the debugger launches and a browser tab opens to HTTP 404.0
The problem resembles this unanswered question, except I'm using IIS 10 instead of 8.5: https://serverfault.com/questions/702235/iis-8-5-instant-404-0-error-on-mvc-site
Details:
Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:80/OURMVCSITE
Physical Path D:\OURMVCSITE
Logon Method Anonymous
Logon User Anonymous
What I've tried
Many StackOverflow answers point to issues with the RouteConfig or Global.asax.cs. I've set breakpoints in both; neither class is ever executed.
The app pool is the default app pool running in Integrated mode under the Network Service user, and Network Service has access to every file and folder in the directory.
Searching for answers in general is somewhat difficult because most results are about creating custom 404 error pages for when users incorrectly enter a URL.

Related

Unable To Browse or Run Uploaded Project Using IIS Server

I am trying to publish an ASP.NET MVC web application locally using IIS server. The files of the application are uploaded but whenever I run the application in the browser (localhost/WebApp), get the following exception:
HTTP Error 500.19 - Internal Server Error
The Request page cannot be accessed becasue the related configuration data for
the page is invalid.
Module: IIS Web Core
Notification: BeginRequest
Handler: Not yet determined
Error Code: 0x80070005
Config Error: Cannot read configuration file due to insufficient permissions
Config File: \foo\web.config
Request URL: http://localhost/WEBAPP
Logon Method: Not yet determined
Logon User: Not yet determined
Config Source
-1:
0:
I've tried to google and tried to follow this link but seems like need some advice to resolve it: (Clearly unable to understand)
Troubleshoot IIS Issue
Do I need to configure anything else in the Web.config file or in the IIS server?
It seems like you don't have Windows Permission to read the Web.config file and I believe, you don't have to change anything in the Web.config file.
In IIS server, add a user IIS_IUSRS using the security tab in the edit permissions sections. It'll allow all the user to access that file. If you ask about the IIS_IUSRS, it means when a web project is run on the IIS server, it associates the application pool with a user like local system, network services. So make sure about it.

HTTP Error 500.19 - Internal Server Error 0x80070003 Cannot read configuration file

I'm getting the above error when I publish my application and move it from development to production server. Below are the error details.
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\C:\inetpub\wwwroot\WorkmenCompTest\web.config
Requested URL http://localhost:80/wictest
Physical Path C:\inetpub\wwwroot\WorkmenCompTest
Logon Method Not yet determined
Logon User Not yet determined
This website used to work previously but recently the published version stopped working due to this error. As far as I can tell, the only change was installing iTextSharp and iTextSharp xmlworker through nuget.
I have tried, without success:
giving modify permission on the site folder to Everyone
checking the web.config file, and using an older version of the web.config file (from when the site worked).
uninstalling iTextSharp and iTextSharp XMLWorker
The project still runs without issue from Visual Studio.
This is solved. The error was caused by the folder name not matching the path for the virtual directory. Oh wow I feel dumb.
Check the applicationhost.config file under - .vs\lpsWeb-UI\config folder of your application root.
Under sites section of the config file check what the physical path points to.
If you modify those you should be able to fix the issue.
This is because of different physical path in the IIS.To change the physical path of application content
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
User Interface
To use the UI
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites node and click to select the site in which your application runs.
In the Actions pane, click View Applications.
On the Applications feature page, select an application from the list and then click Basic Settings in the Actions pane.
In the Physical path box, change the path of the application content.
Click OK.
DefaultAppPool application pool runs under the Network Service account. This account is local to the computer and this account does not exist on another computer. Make sure that you configure the DefaultAppPool application pool to use an account that is a domain user. Then, you can use the same account on the WorkmenComp file server. Alternatively, you can create a workgroup account on the WorkmenComp file server.
I am getting this HTTP Error 500.19 error when I am giving physical path as Z:\App_Live in IIS
Instead of using z:\ ,
I used network path \\server\share\live_folder in the IIS physical path – something like this \\server\share\wwwroot\inetpub\wwwroot
Also you may need to specify username/password in "connect as".

Runtime Error on Website (asp.net versions mismatch)

I'm quite new to this and was playing around with a website today. I decided that, since I had tinkered with most pages I'd just upload the whole thing via Filezilla anew but when I tried to access the website afterwards I only got this:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
I have backups and tried uploading them (again - the whole thing) but its coming up with the same error. What should I do to get my site back online?
Check the application pool the website is using matches the .net framework version site was developed using. Amend the IIS application pool to match and restart the site.

ASP.NET Web Application Error

I have an application with the main and 2 sub pages. The main page works and one of the sub pages work fine. But the other sub page gives me an error:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
When trying to run on my local, i get
An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
These were working fine a week ago and this problem is sudden. help please.
You are facing this issue because the SubPage you are getting error on accessing might be under some security. The error you have described comes on a page which is not accessible to the anonymous user.
You must check the Web.config firstly to see if there is some Location Access permissions defined for that Webpage and ensure that they are correctly defined.
You may read about more to this problem by a previous Answer.
web site configuration

Problems deploying a web application

I am trying to deploy a web application to a remote server over which i have no control.
If I use FTP deployment from visual studio, I manage to get the files onto the server, but when I point my browser to the server, it gives me the standand error page:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error >settings for this application prevent the details of the application error from being >viewed remotely (for security reasons). It could, however, be viewed by browsers running >on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote >machines, please create a tag within a "web.config" configuration file >located in the root directory of the current web application. This tag >should then have its "mode" attribute set to "Off".
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's >configuration tag to point to a custom error page URL.
I have made shure that custom errors has mode="Off" as the text above suggests. No amount of refreshing or Cntl-F5-ing gives me anything other than the error page above.
Its most likely is that the location you have put it is not setup as an IIS Application and this is required for the .net framework application to work correctly.
As you have no control on the server you won't be able to change the IIS settings, and so dropping .net onto the server isn't quite the xcopy deployment method Microsoft pushed lots.
Please verify the virtual directory is mapped to the publish location properly. Because your question tells changing the web.config has no impact.
Probably your application on remote server isn't defined as application in IIS. This means that it can't find it 'code' resources(bin or App_Code directories) and customErrors setting is taken from parent web.config.

Resources