.NET MVC Error 500 when publishing to production server - asp.net-mvc

My MVC website is working perfectly on my debug machine when I press F5 in Visual Web Developper Express 2010. I've publish it a couple of time without problem but I did a lot of change lately and my latest publish didn't work as expected.
In fact, the publish works perfectly and no special message are shown. But the problem is that when I connect to the adress, I get an error 500. I google that and add the required web.config info so I get the detailed info.
Here is the information I get:
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has
occurred.
Module: AspNetInitializationExceptionModule
Notification: BeginRequest
Handler: ExtensionlessUrlHandler-Integrated-4.0
Error Code : 0x00000000
Can anyone point me in the right direction to debug this? I can give you more information about my application if necessary!
Thanks!

Ok I found this myself with the help of the helpdesk and google.
Helpdesk send me to a link on how to show more error on the website.
Then I saw my error was "Access to the path XXXX is denied". This was related to the ClientDependency framework and was trying to access a path that doesnt exist on the server
I discovered on google that this path was specified in the web.config so I change the path.
Wasn't working more so I went on the server and changed the permission on this folder
It worked.
Hope this might help someone one day!

Related

ASP .NET MVC 500 Internal Server Error - on Get and Post - same application / different servers

I'm trying to help our System Admins here, so please don't beat me up for my lack of knowledge. We can run the application locally and we can build and deploy to our Test Server and the application reports work as expected. But when we deploy to our Production Server, many of the Get and Post Ajax calls are getting 500 errors. Essentially, all reports run everywhere EXCEPT on the Production Server.
This is an ASP .NET MVC application with the views being Razor HTML and JavaScript. The model, controllers, and services are all in C#. IIS 8.5 web server and SQL Server for the database.
I've Googled and tried everything I could find. More detailed errors show us the service call that fails along with the parameters and all looks good. Again the application reports run fine in all environments other than the Production Server. Does anyone have any idea why this is happening and what we should be looking at to resolve the issue?
Thank you in advance.
Just turn off custom errors in the web.config file
<system.web>
<customErrors mode="Off">
</system.web>
and then open up the development tools in a browser during one of the GET requests and replay the GET yourself. Should get the exact error message back.
It took us all day to figure out that one of the parameter tables did not have the appropriate permissions. Which would explain why some reports ran while others consistently returned a 500 error.

Asp .net MVC is working when I run it locally but I get internal network error when I deploy to azure web apps?

I am having an internal server error immediately when I deploy my code to Azure web apps even though it runs perfectly fine on my own machine. My code is from a tutorial and close to this example:
https://github.com/elishnevsky/OdeToFood/tree/master/src/OdeToFood
However I do not have a web.config or an OdeToFood.xproj since they are not included in the tutorial. I tried including the ones that are in this git project but the error doesn't change. I ensured the permissions were configured to allow everyone to have full control.
My project is connected to a remote database that I can successfully connect to and manipulate from my local machine.
I have gone into the azure diagnostic tools and turned all the logging options on, however the error message being shown in the log stream doesn't change.
The error can be seen below.
I have tried including a random image to counter the favicon.ico error but that did not change anything.
Can anyone advise on some debugging tips, I think I need an idea on how to get a verbose error message.
IIS Detailed Error - 500.0 - Internal Server Error
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Most likely causes:
IIS received the request; however, an internal error occurred during
the processing of the request.
The root cause of this error depends on which module handles the
request and what was happening in the worker process when this error
occurred.
IIS was not able to access the web.config file for the Web site or
application. This can occur if the NTFS permissions are set
incorrectly.
IIS was not able to process configuration for the Web site or
application. The authenticated user does not have permission to use
this DLL.
The request is mapped to a managed handler but the .NET Extensibility
Feature is not installed.
Things you can try:
Ensure that the NTFS permissions for the web.config file are correct
and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a
managed handler.
Create a tracing rule to track failed requests for this HTTP status
code. For more information about creating a tracing rule for failed
requests, click here.
Detailed Error Information: Module AspNetCoreModule Notification ExecuteRequestHandler Handler aspNetCore Error Code 0x00000000 Requested URL http://OdeToFood20170518102616:80/ Physical Path D:\home\site\wwwroot Logon Method Anonymous Logon User Anonymous
More Information: This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
Microsoft Knowledge Base Articles:
IIS Detailed Error - 500.0 - Internal Server Error
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request.
The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click.
Detailed Error Information: Module AspNetCoreModule Notification ExecuteRequestHandler Handler aspNetCore Error Code 0x00000000 Requested URL OdeToFood20170518102616:80/favicon.ico Physical Path D:\home\site\wwwroot\favicon.ico Logon Method Anonymous Logon User Anonymous
More Information: This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
Microsoft Knowledge Base Articles:
According to your github project, I have crate a test demo on my computer. I found this project has define a custom Physical File Provider (You could find
the it in the Middleware folder: UseNodeModules).
By cloning the project to the local, VS will automatic download the js file into the node_modules folder.
When publishing the project to azure web app service, the VS will not copy the node_modules folder to the azure web app. So the application will how 500 error.
I suggest you could find the UseNodeModules folder in the local and copy it to the azure web application.
More details, you could refer to below steps.
1.Open the KUDU console in your web app.
2.CLick CMD console and local the wwwrot folder
3.Add new folder and upload the node_modules folder.
Restart the application, them your project will work well.
Since your project isn't as same as the github projects, if you still get the mistake.
I suggest you could change the application setting as below to see the details error message.
1.Open application setting in your web service portal.
2.Add Hosting:Environment as below:
Besides, I suggest you could check your web application's connection string. Azure web app couldn't connect to the local server if you don't use Hybrid connections.
I suggest you could create a azure sql server and change the connection string as azure sql server's connection string.

How I do for my project using Local IIS

I'm using Visual Studio 2013, Windows 8.1 and IIS 8.0.
In properties settings, I have set the server to Local IIS and I set the project url to localhost/myProject.
When I debug the project I get the following error shown below:
Unable to start debugging on the web server. The web server could not find the requested resource.
Click Help for more information.
OK Help
and when I start without debugging I get this error:
Error HTTP 403.14 - Forbidden
can somenone help me?
You need to give proper permissions to the directory containing your application. Give read, write, and modify permissions to IUSR and IIS_USERS. This should help to resolve your issue. Did your application work using IIS Express? If it didn't work using IIS Express then I'll need more specific information on the issue you're running into.

MVC Site getting 500 error only on server, how do I get more info on error?

I have an MVC 5 web application that runs perfectly fine in VS when I debug it but the moment I deploy to my IIS server (Windows 2012 R2) I get a 500 internal server error. I have even enabled debug=true in the web.config on the server but get no detailed error. Nothing is showing in the event log I have restarted the web site in IIS and recycled the app pool with no change. What do I have to do to figure out what is not working on the server side?
By default, IIS hides debug information from remote connections. This means you need to log on to the server and browse the site there, or you need to turn off Custom errors in your web.config (change from RemoteOnly to Off).
Many kinds of configuration errors in IIS however, will only show up properly if you browse on the server.
While I did not find exactly what was wrong. I ended up rebuilding my site from the group up and in doing so I did figure out that it was something to do with the web.config but there is so much of the web.config file I left out of the new site I don't know the exact code in it that caused the problem.

Azure Websites 500 Error

I've deployed several websites to azure websites previously without a problem. I always add the elmah nuget package because it make diagnosing issues easier. However, I'm currently stuck with http://yis3.azurewebsites.net
When I try to reach the site I get an http 500 error. I've tried following the suggestions from this page msdn but I've hit the following problems:
Will not load symbols when I attach debugger. I've ensured site is compiled and published as debug
Despite enabling tracing and selecting "View Streaming Logs in Output Window" all I get in the VS2013 output window is "Now new trace in the past 1 mins, 2 mins etc"
The website uses EF6 to connect to a SQL Express database. I've checked the connection strings in the web.config and websites portal - they look ok. I guess the site is failing before trying to reach the database though - the /home/documents action should return a view with hard-coded html and even that fails!
I have checked the website is configured to run .Net v4.5
Could anyone please advise what else I can try?

Resources