So I followed this tutorial to add logging to my project. Locally everything works fine, but when I deploy it to my staging environment and try to even visit the root page of the site I get a 403.14 Forbidden error saying that I need to enable Directory Browsing. I read somewhere that log4net uses a different user account to log and that could be causing issues. I was also thinking that it could be due to the location I am logging. I was hoping someone else had experienced this and could point out a solution.
The problem isn't with your code or Log4Net, it's with your hosting environment's default settings. Change the directory of the log file that is being written to a directory where you actually have rights, or change the access on the directory to which you are writing... Sounds like you're on a shared hosting server, and you usually need to manually enable whether or not a directory can have write access (ie: GoDaddy, etc). I've had this a few times and it was simple as that. This is why it was working locally (you have permissions to your own machine) and not once it was deployed.
Related
Deployed an MVC5 site on IIS7.5 and receive this error when trying to access remotely:
403 - Forbidden: Access is denied.
From the server itself, I do not receive the error.
I tried the common suggested fixes like adding
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
to web.config, and running aspnet_regiis for version 4.0.30319, but nothing works.
Months back I had deployed another MVC site (though it was MVC version 3), and it is up and running, without this nonsense. I can't remember exactly what was done to successfully deploy, but I don't recall headaches like this. Just out of speculation this wasn't due simply to the newer version of MVC, I copied and pasted the folder of the working MVC3 web app, converted it to an application through IIS, used same app pool, and... receive the remote 403 error on it. So with an exact copy giving a 403, while the app that I copied works fine, tells me there's some IIS setting I might be missing? Obviously the web.configs are exactly the same. Folder permissions look the same. I put a test html page inside the web app folder, and I can access that through a browser remotely. I don't know, I don't spend too much time in IIS configuration hell, and it's frustrating beyond belief. If anyone has any ideas...
Since you said that it worked locally the issue must be here:
Check your App_Start/BundleConfig.cs file for css references which match the physical folder path of the project.
Here is an example:
bundles.Add(new StyleBundle("~/Content/bootstrap").Include("~/Content/bootstrap/less/bootstrap.css"));
As you can see, /Content/bootstrap is also a folder path. What you have to do is, rename this style bundle to something else. Say, "~/Content/bootstrap-css". Basically, it shouldn't match a physical folder path.
I had this problem, it works locally but not on the server. So, it should help!
Cheers!
Check the Basic Settings for your domain in IIS. Set it to DefaultAppPool. This resolved the same issue for me.
I have an asp.net mvc 3 app installed on IIS6 and I am getting ACL errors (401.3 errors) when trying to access it. It is running as a virtual app under the default web. I have gone through what I believe are the correct security setting on the respective folders.
I have given the Network Service and in IUSER_ users access to the root folder of the default web. I have also given access to the microsoft.net, temp and system32 folders under c:\windows.
I still get the 401.3 error. When I set the app to use both anonymous and windows authentication I get prompted for credentials. Entering the credentials allows me to access the app. This means that there is some file/folder that needs permissions.
So I used FileMon to see what was going on. I hit the site and get the ACL error but I see no ACCESS DENIED errors in FileMon nor so I see any reference to the site itself. It is like I never made a request. (Yes I cleared my cache).
I am tapped out on what to do next. Any suggestions on where to look to determine what resources needs permissions?
Thanks in advance!
In order for MVC to work on IIS6, you need to do some configuration changes in IIS. Specifically, you should tell IIS to handle all request, in order to ensure that the .NET routing engine kicks in.
http://haacked.com/archive/2010/12/21/asp-net-mvc-3-extensionless-urls-on-iis-6.aspx/
This is one of the best tutorials on getting MVC to work with IIS6.
I am working on a asp.net website which is created by someone else.
Some files are exist in root folder and some are exist in one sub folder.
I can access all files from root folder in the browser, however when try to access the pages from sub folder is shows following error
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.
I unable to point out the issue. I checked the web.config file, but didnt get anything related to that folder. I know it is difficult to find the exact issue in my case, but I would appreciate if anyone can give me possible reasons or clues so that i can try.
Thanks in Advance.
EDIT
There is a sub folder web.config with the following content
However, even if I login with "administrator" it fails.
I got the issue, actually previously it was Forms authentication which I commented out.
Is there a web.config file in the sub-folder? These can apply local restrictions.
Other questions that it would be good to know the answer to:
What authentication scheme (forms, windows etc) are you using?
What sort of content are you trying to access (static content or aspx)
what version of IIS are you using?
This sounds like an ACL problem to me. More information, as Xhalent asks, would be useful. Does the user that IIS is using have access to all of the files on the file system?
I have a aspx file that suppose to write to a file in the server while loading. On the local machine it works fine, but when i deploy it to a live server it gives me an exception "Access to the path 'd:\DZHosts\LocalUser\asafz83\www.asafz83.somee.com\lala.htm' is denied."
WHen i asked my serverAdmin for the reason - he told me to remove any impersonation from my web.config file. Well, my web.config file doesn't contain any impersonation, so i'm really confused:
What can i do in order for this sealy-stupid application to work?
thanks!
Assuming the id being impersonated has appropriate access to the server & folder that you are writing to, you have to allow your web server to be trusted for delegation.
See this for Windows 2003 server:
http://technet.microsoft.com/en-us/library/cc738491(WS.10).aspx
I've had the same problem a couple weeks ago..it took us a few days to figure out that it's just a checkbox that needed to be set.
You don't have to go through impersonation.
Create a folder in your website, let's call it "Files". You can access its path via Server.MapPath to do whatever saves you want in that directory.
Server.MapPath("~/Files")
When you deploy on IIS, you have to apply Write permissions on the folder "Files" for the ASP.NET user.
Essentially your server admin is saying that you may not have the permissions needed to perform the operation / access th path in the error.
Is this a valid path that you think you should have access to, if it is then there is a chance your application is configured wrong.
Your admin guy is basically saying ...
In the web.config file check that you have not got something that reads like this :
if you do, remove it because you re trying to impersonate / get asp.net to run within the context of the guest account for internet users connecting to the server.
There is more on the topic here ...
http://msdn.microsoft.com/en-us/library/xh507fc5(VS.71).aspx
Something worth noting is that application configs "inherit settings from parent applications", this means if you have a web app running that works with this, and then in a child folder deploy a new web app that does not have the right to do this then it will break because of the parent applications settings.
This may or may not be relevant to your situation but i feel its worth noting.
I don’t know anything about deploying a website, so I probably made some stupid mistake.
Anyways, I opened IIS 7 manager, created new virtual directory ( via Add Application ) and pointed it to physical directory where Visual studio saved my Web project. But when I tried to request an .aspx page, browser reported the following error (I won’t post the whole error, but just the interesting bits):
Handler: Not yet determined
Config Error: Cannot read configuration file due to insufficient permissions
Logon User: Not yet determined
A) why is handler not yet determined? As far as I know, IIS7 does have Asp.Net handler registered?!
B) Why wouldn’t IIS have sufficient permissions? Does that mean I should give IIS higher privileges? Or does Asp.Net runtime have insufficient permissions?
C) Could the error also be due to the fact that perhaps it expected the user to authenticate itself? I’m assuming this due to Logon user not yet being determined?
D) And finally, any ideas how to make it work?
thanx
error code:0x8007000d
I started playing with permissions and all the stuff about access issues to web.config or applicationhost.config anyway those did not change the error.
while I was playing with my web.config I deleted rewrite tags from my config file and error changed. then I installed "web platform installer" and installed url rewrite module for IIS and played with some configuration now my site is working. it took about one day to find out this issue I hope it helps someone.
Does the identity of your IIS application pool have sufficient rights to access the folder that is hosting your site?