Cannot host web applications - asp.net-mvc

I have created a new web app using mvc 3 in visual studio 2010. I'm still using aspx view engine.
I have copied the files (bin, content, scripts, views, global.asax, web.config) to the C:\inetpub\wwwroot -folder. I have done that manually, using publish -> file system (in VS) and by building deployment package (in VS)
I have set applicaton pool in iis 7.5 (win 7 x64) to .net 4.0 and integrated mode.
I have created a new site that uses the folder C:\inetpub\wwwroot and app pool above.
I try to run the website and I get this:
6-i set permition for iis user
Error Summary
Internet Information Services 7.5
Error Summary
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070005
Config Error Cannot read configuration file due to insufficient permissions
Config File \?\C:\Inetpub\vhosts\n-clinic.ir\httpdocs\web.config

What concerns me the most about your error message is the line
Cannot read configuration file due to insufficient permissions
Sounds like a classic case of permissions on the website directory. Try adding read/write access to 'everyone'. If that fixes it, try to work out the user that is actually being used and readjust your folder permissions accordingly.
The following link might also help track down the cause of your error:
http://support.microsoft.com/kb/942055

Related

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 to precompile MVC for intranet?

VS2013 Update3, .Net 4.5, MVC, IIS 7
I created a new mvc project.
Tested from VS and it works.
From IIs, I created a folder in wwwroot, and made it an application. Add app pool with .net 4.0. Enabled windows authentication and disabled Anonymous authentication. Set service account in app pool and webapp.
From VS I deploy to IIS with default settings (which is NOT precompile) (using File System)
Site works fine on IIS.
But…
If deploy with the precompile setting clicked on. Web site fails with 403 error. Tried various combinations and get never get the precompiled to work. Always works when non-precompiled.
ASP.NET 4 was is registered in IIS.
Tried modules runAllManagedModulesForAllRequests="true" with no success.
I'm out of ideas and looking for help
Server Error in Application "xxx/MVCHELLOWORLD"
Internet Information Services 7.5
Error Summary
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Detailed Error Information
Module
DirectoryListingModule
Notification
ExecuteRequestHandler
Handler
StaticFile
Error Code
0x00000000
Requested URL
http://xxx/MvcHelloWorld/
Physical Path
C:\inetpub\wwwroot\MvcHelloWorld\
Logon Method
Negotiate
Most likely causes: •A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
Things you can try: •If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
• Enable directory browsing using IIS Manager. 1.Open IIS Manager.
2.In the Features view, double-click Directory Browsing.
3.On the Directory Browsing page, in the Actions pane, click Enable.
•Verify that the configuration/system.webServer/directoryBrowse#enabled attribute is set to true in the site or application configuration file.
Links and More InformationThis error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
View more information »
I just had the same issue and have been trying to resolve it for the last couple of days.
I have a Windows 8 pc running IIS 8 Express.
I copied an MVC site that was compiled and published from another pc, ran it, and got the same 403.14 forbidden as above. I then tried publishing the site uncompiled and running it and the site loaded just fine.
I then decided to load Visual Web Express on the Windows 8 pc and created a dummy MVC site and ran it compiled and uncompiled and it worked just fine. This showed me that IIS 8 Express was configured and working properly and there must be some issue in the way the site was compiling.
I tried different precompile methods during the publish including do not merge, merge all and merge each folder but none of those many any difference.
In the end I solved this by changing the Copy Local property to true for every Assembly referenced within the project. Even all the default ones that should be referenced from the GAC.
Not sure if I needed to copy every assembly to the bin folder or not but given the large number of assemblies referenced within my project this seemed easier then trying them 1 by 1.
EDIT: Made some changes and republished the site and now I'm back to the 403.14 forbidden again :(
I'm really pulling my hair out on this one as to why it isn't working.

Issue hosting ASP.NET MVC 4 application using IIS 7.5 after creating virtual directory - Script files are not working

I have an ASP.NET MVC 4 application that I am trying to host in IIS 7.5. I tried creating a virtual directory using "Use Local IIS Web server" option in Project properties and have set the Anonymous Authentication and Windows Authentication set in IIS.
When I run the application, it opens in the browser with the url, "http://localhost\ApplicationName" and I am able to view only the tab names I have created. When I right click and view the page source, I have my scripts listed and the body defined with divs and tables. When I click the tab names, nothing happens.
In the view page source, when I click any script, it throws an error,
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:80/Scripts/Script.js
Physical Path C:\inetpub\wwwroot\Scripts\Script.js
Logon Method Anonymous
Logon User Anonymous
In IIS, I have enabled Anonymous, ASP.NET Impersonation and Windows Authentication.
Also, When I look at the Advanced settings for the directory, it shows the physical path in C\Users........ but in the Detailed Description, it shows the Physical Path as "C:\inetpub\wwwroot\Scripts\Script.js".
Am I giving the path wrong? or should I place the project files in "C:\inetpub\wwwroot\Scripts\Script.js"?
Please help. I have been struggling with this for a while now and it's driving me crazy.
Are you using URL Bundles or are you manually hard coding .JS paths in your front-end code? Are you seeing good/expected behavior when you run the site in debug mode within Visual Studio? I would try and gather some hints with those considerations and perhaps furnish some more information...

Publish ASP.NET MVC Application : read configuration file permissions

I am having some trouble when publishing an MVC application to a server, and even to my personal computer.
The server has the MVC framework installed so that is not the problem, and I also have it installed obviously.
The problem on my local machine is obviously a permissions thing but im not sure what permissions are needed... I tried adding IUSR to the application itself.
The iis error message is:
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 ~\Visual Studio 2008\Project\MVCApp\web.config
and on the server im getting "The page cannot be found" when trying to view anything in the app.
also this is a forms auth app that denys everything but authenticated users
You need to have wildcard mappings turned on so that it can resolve the routes.
Take a look at option 1:
http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/
Basically, IIS is trying to locate a file at the given URL, but it doesn't exist because they are MVC Routes. You need to tell IIS to hand off the request to the ASP.Net route handler, and not to worry about checking if the file exists on the file system. (it will never exist)
I found out that upgrading an MVC 2 project to MVC 3 resulted in the sam error as described above:
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 ~\Visual Studio 2010\Project\MVCApp\web.config
What solved the problem for me was to delete the Virtual Directory for the project in my localhost IIS, and then clean and rebuild the project.
NOTE! This was an MVC2 project in VS2010 - not VS2008.

Can you run an ASP.NET MVC application from its project folder?

In IIS 5.1, I have setup a website to point to my ASP.NET MVC project directory, and I get a "Service Unavailable" error when I try to access it after building the project. It seems I have to publish the site to a separate directory and point IIS to the published version to get it to work.
I have already tried "aspnet_regiis" but that did not fix the issue. I have also setup wildcard mapping so all requests are sent through the ASP.NET pipeline.
I'm not sure why I would have to publish the files in order to view them. The published version appears to only remove unnecessary files, but the published files seem to be identical to the ones in the actual project directory.
Do you have to publish an ASP.NET MVC website to a different directory in order for IIS to serve it?
Ideally, I would want to set it up such that all I have to do is build the project, and I can immediately view the updated website by visiting localhost.
Update:
The version is set to 2.0, and when I get home I will check if the IUSR account has sufficient privileges. I can't imagine why it wouldn't because the published folder apparently had them by default.
Update #2:
The errors in the event log are:
Failed to initialize the AppDomain:/LM/W3SVC/1/Root
Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
and
Failed to execute the request because the ASP.NET process identity does not have read permissions to the global assembly cache. Error: 0x80070005 Access is denied.
I have given the MY_MACHINE\ASPNET account "Act as operating system" privileges and I still get this error.
Update #3:
So this is interesting... I have XP Media Center Edition, so I forgot I don't have a security tab to verify permissions.
I decided to copy and paste the entire solution into a newly created folder and it works perfectly. This indicates that it's a permission issue but not with the ASPNET user. I will try to activate the Security tab and make a 4th (and hopefully final) update.
Update #4:
It turns out that when I copied the directory, the permissions changed to allow Everyone access to it. When I checked the original project directory, the ASPNET user was not granted any permissions in the directory.
The simple solution was to grant the ASPNET user read privileges on the project directory.
No problems at all. I've been running an MVC app on IIS5.1 for 6 moths while developing it.
First off check the version of ASP.Net used for your site.
If that isn't the problem check that the user account used to run your website has permissions to the directory and all the files and folders contained within it and make sure that the network service has permissions.
take a look at this link - which might help:
http://weblogs.asp.net/bdesmond/archive/2003/09/20/28441.aspx

Resources