Install asp.net mvc application on windows server - asp.net

I have following problem:
there is windows server 2008 r2
it has iis 7.5 installed
I moved my application there (it is asp.net mvc 5 application), installed .net 4.5 framework on the server
ran following command in cmd
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
tried also %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir
but still it throws exception:
403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.
I enabled directory browsing and only thing that it can make is browse through folders. But it is web application and not file directory to browse.
So can anyone tell me what am I missing?
IIS configuration:
UPDATE 1
IUSR and IIS_IUSRS both have full control
I also tried adding Everyone with full control on the folder where my application is, but still same

make sure that the MVC Dll's are included in the build output of your project.
Also try adding this code to the system.webserver part of your web.config
<modules runAllManagedModulesForAllRequests="true">
https://www.iis.net/configreference/system.webserver/modules
<modules runAllManagedModulesForAllRequests="true" /> Meaning

If you are trying to test your site by launching http://yourdomain.com/ then it will display all files like you are "Browsing the Directory", you have to add a default document - this is the your main or landing page on your web application settings.
On IIS Manager, click your site, on the right pane, under IIS, click Default Document and set the page you want to show first.

"403 - Forbidden: Access is denied" means the IIS doesn't have the rights to access the resources in your application folder. It is usually a problem with the user the IIS uses to access the resources.
Just as a test: give "everyone" the full rights to the directory where your application is located. If this works, remove "everyone" and give the user IIS_IUSRS the rights to read the resources on the directory (maybe this user needs rights to write in the App_Data folder).

go to published folder of your application and give edit update access to iis user to that folder then it will work,
right click on folder
click properties and then click on security and then full control to iis user.

Related

Web configuration file being accessed in the wrong folder

I have deployed an asp.net website on a production server. It is working on my local but on the server I get this error:
An error occurred loading a configuration file: Failed to start
monitoring changes to
'E:\HostingSpaces\xxxxx\xxxxxx.xxxxxx.com\wwwroot\admin\web.config'
because access is denied
This looks to me that the app is looking for the web.config in the admin folder while it is obviously in the root.
How is this possible? How do I solve this problem?
IIS which is hosting ASP.NET is looking for a potential web.config file in every folder of your site, not just in the root folder.
This is because you may want to override certain settings for just one folder.
So you may have a web.config in admin but IIS hasn't got access to it, or IIS hasn't got access to the whole admin folder.
Check the permissions on that directory.
The problem is that the directory it has been deployed to does not have the correct read/write permissions for IIS to read the web.config.
Each website configured in IIS 6+ runs under a specific AppPool. That app pool runs under a specific user account, and it is that user account that needs read/write permissions to this directory.

how to publish web service in v.s 2012 on local machine

1- I've publish web service in v.s.2012 and automatically creates the .zip file.
2- but in IIS , after clicking 'browse' option the i got "HTTP Error 401.3 - Unauthorized. You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server."
Make sure the IUSR account has enough permission on the wwwroot folder. It is the default user for anonymous authentication. (Rightclick on wwwroot -> properties -> security -> select IUSR)
EDIT:
Also found this post with the same Problem, also explaining the above posible solution and others, maybe this helps:
ASP pages in IIS using Localhost 401.3 Error do not have permission

ASP.NET Application getting errors when I deploy to IIS 7.5

I created a web application in Visual Studio 2010 and when I run it on my local PC via Visual Studio, everything runs just fine.
When I try to copy thew files onto my server to deploy it, I get errors.
Here's what I did:
Created a new website in IIS. Path is "C:\Apps\PLOT\ServerStats".
Started it.
Checked ASP.NET authorization rules, and it is consistent with what I have in my web.config file.
<authorization>< allow users="usmanas" />< /authorization>
Checked the Connection Strings section and all my connections are consistent with what I have in my web.config.
Checked Authentication section in IIS section and it says Windows Authentication is enabled, just as my web.config says.
When I try to browse the website, it says "Server Error in '/' Application." and "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."
My web.config in the root directory of the application DOES have this set...<customErrors mode="RemoteOnly"/>
Can someone please help me get my application set up?????????
The IIS_IUSRS has to have read priviledges on your folder.

The requested page cannot be accessed because the related configuration data for the page is invalid

I am getting this error when I try to run an ASP.NET application without a web.config file.
The requested page cannot be accessed because the related configuration data for the page is invalid
as I read, we can run .NET applications without web config files, but when I tried it is giving me the error. I am using iis 7 on windows 7 machine.
When I create the application virtual directory inside inetpub/wwwroot it works fine. Why doesn't the other directory location?
One reason could be the version of .NET framework (on IIS or application pool level) is different from the application one.
Another reason could be if there are modules used in your web.config which the current configuration of IIS doesn't recognize. E.g. URL rewrite or other optional modules, which you have to explicitly enable before using.
This can be a reason:
If there is no Web.config file in the
UNC directory, IIS 7.0 uses the rules
that are defined for the parent
directory. For the Web content to be
served in this scenario, the
worker-process identity must have
access to the whole content directory.
Otherwise, the Web request is
rejected.
Details here.
You need to set permission for your Website folder or copy them to wwwroot folder.
If you choose to set permission, there are two ways:
Right click on Your Website folder, or
Right click to Your Website in IIS
Then select Edit permission and Add a permission (IUSR - default iis user)

ASP.NET permissions issues

Im using Windows Server 2008, IIS7, .NET 4 and when I use the FileUpload control to save a file to a directory I get :
Access to the path 'C:\xxx\Websites\CMS\Admin\test' is denied.
I have given the test folder full control permissions for NETWORK SERVICE but it makes no difference.
I have given full control to the Everyone user but makes no difference.
It might have something to do with the fact that up in the CMS folder there is a MVC web application and in the CMS\Admin folder there is a web forms web application. It is the web forms web application that is trying to upload the file and getting the permissions error.
Can anyone offer a suggestion.
Are you running your application in Medium Trust? Medium Trust does not allow file IO outside of it's own virtual path hierarchy.
Check the web.config for a <trust level="Medium" ... element.
Check the Application Pool that your site is running under and make sure that it is running as NetworkService instead of PoolIdentity.

Resources