IIS 7.5 and Razor Site: 500 errors for CSS and JS - asp.net

For some reason, when I deploy my Razor MVC web site to my Windows 2008 R2 server, I'm getting 500 internal server errors for all CSS and JS. I'm not sure why, because I've done the following:
Enabled static content in IIS
Enabled anonymous access, with the default ID being the application pool identity and given that identity read/write permission to the folders
Ensured my static content handler was setup correctly
What other problems could it be? How can I even debug this to see what the actual error is? Even though I have an Application_Error handler, nothing is getting logged. And IIS logs doesn't give me the error info?
Thanks.

Mime-Types were my trouble
I had the same problem. My css and js was not delivered. Server says internal error.
I found out that i added the mimetype for mp4 in the global settings of the iis and also added the mime type in one of my websites as well.
That was a problem. This mime-type can only exist in the website or global, not both.
I deleted tehe global mimetype and everything worked like it should be.
Hope to help some guys of you.

Just found, that I've added to web.config *.woff MIME for IIS 7.5, so when deploying on IIS8, it's causes static files error. After removing that from web.config everything is fine.

I got 500 errors because I added this below to my web.config. After I removed it, I got passed the error.
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>

To rule out one basic permissions situation, try this:
Select your web site and go into Basic Settings.
Take note of which application pool your site is running under.
Exit out of there and select the Application Pools node.
Find the application pool for your site, and take note of which identity (account) that application pool is running under.
If the account is a specific user identity -- in other words, if it's not a built-in account (such as ApplicationPoolIdentity, Network Service, Local System, etc) then:
Launch your Local Users and Groups.
Find and open the local IIS_IUSRS group.
If the account in question is not a member of the group, add it.

Reinstalling IIS fixed the problem.

If you are on your local server and taking this error, please check if you have any missing packages. Catch errors in global.asax and if neccessary reload all packages with;
Update-Package -reinstall
in Package manager console.
Hope it helps.

Related

MVC error 403 - Forbidden: Access is denied. Works locally but not remotely

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.

HTTP Error 403.14 - Forbidden Error when accessing website

So I have all the updated code, the entire solution builds. It works on everyone else's machine, however when I try and access localhost/extranet on my machine, it gives me this error:
HTTP Error 403.14 - Forbidden
Detail Error Info:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler 0x00000000
Requested URL http://localhost:80/extranet/
Physical Path C:\svn\K2\trunk\appteam\web\Chatham.Web.UI.Extranet\
Logon Method Anonymous
Logon User Anonymous
Now I tried going into IIS7, and enabling directory browsing, this removed the error, but still didn't bring up my website. I also tried going in and disabling the default document, re-enabling it, everything, nothing worked. I've also restarted IIS a few times to no avail.
Any ideas?
It sounds like your IIS is not processing the routing rules for your application and is trying to find a default.aspx, index.htm, etc. Since it cannot, it is wanting to display the directory listings (which is why you were getting the 404.14).
I just checked my dev setup and I think that your AppPool has to be set on Integrated as opposed to Classic on the Managed Pipeline for the AppPool. I have ran into this before, there may be ways to use the Classic Pipeline, but this would/should be the quickest way to resolve your issue. To check/change the pipeline mode, click on Application Pools from the menu on the left side of IIS, find your AppPool and look in the managed pipeline column. If it is set to Classic -> Right click the AppPool, choose basic settings, then change the dropdown from Classic to Integrated.
If I am incorrect, someone please feel free to correct me on this in the comments.
Edit - Just to add, you can run an MVC app in the Classic Pipeline mode, but you have to do the IIS 6 tricks to get it to work properly. Mainly, you need to turn on wildcard script mapping for MVC to work in Classic mode, If not it expects an .aspx file (or similar) to exist for it to handle the execution pipeline over to .NET from IIS.
Causes this error is removed Global.asax file from your root directory of your site.
To solve this problem add a Global.asax file to your project.
See here: How to add Global.asax file to ASP.NET MVC4 project
In IIS, you need to find out which app pool your application is running from. Just right click the web application under Sites>Manage Web Site>Advanced Settings. The first property should be the app pool.
Now, click Application Pools. You should see a column called "Identity". Add that user to the ACL of the C:\svn\K2\trunk\appteam\web\Chatham.Web.UI.Extranet\ directory. If it just says 'ApplicationPoolIdentity', it can be a little tricky figuring out the user. If it's just running under DefaultAppPool, you can use IIS AppPool\DefaultAppPool.
My solution was because I didn't have ASP.NET installed via "Turn Windows Features on and Off" so it was simple. I figured it out by enabling directory browser and trying to go to my views folder which then gave a more descriptive answer and pretty much said that there was a problem with a module because ASP.NET is not properly installed. It then dawned on my to go and install it.
Change the 'start page' by right click on the page and select 'Set as Start Page' that you want to open first when the web application starts first. This might solve your problem. :)
Also make sure in IIS Application Pool settings that Enabled 32-bit Applications under Advanced Settings is set to FALSE. I spent hours trying to fix this and that was my issue. Windows Server 2012 IIS 8.5
I solved this problem by setting exact .net framework. My website was using v4.0 version of .net.
Workaround to handle the problem:
Open command line as an administrator
Go to directory "C:\Windows\Microsoft.NET\Framework\v4.0.30319"
Execute the following: aspnet_regiis.exe -i
Open IIS and change Pipeline Mode of Your application to Integrated
Hope this helps
In my case the HTTP Redirection feature was missing on the server (with IIS 10).
Adding the feature resolved the issue and the site started to load fine.

ASP.NET: Errors not viewable despite proper configuration

I'm having the classic (dare I say typical?) error on the ASP.NET production server, which tells me that I can't view errors. Below the error displayed below, are things I've already tried.
In IIS Manager (6.0), the application is located under one of the web sites in "Web Sites". It is indeed a web application, as opposed to a virtual directory (it has that gear icon).
When trying to view the error from the localhost (i.e. the server itself), it doesn't find the application on its path, even though the root web site works just fine from localhost. It is clearly not a firewall issue because first of all, the firewall is turned off, and second because the root web site works fine from localhost. Heck, I even tried connecting through telnet and that worked fine and dandy too, so it is most certainly and very clearly not a firewall issue.
Basically, I just need to view the error at all. I won't have to fix this problem if I can just see the error and fix it, because obviously there is something wrong in the code itself... I just don't know what, because IIS/.NET won't tell me.
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".
So what I've already tried is what the error message itself suggests by setting the customErrors thing to "Off". In fact, it always was on "Off" so I didn't have to change anything. I've made sure that the web.config XML is valid.
Another common reason for this error is that the .NET run-time is set to version 1.1, not 2.0. I've also made sure that this is correctly configured to 2.0.
I'm running it in an independent application pool, meaning that there are no other applications at all, much less 1.1 applications, on the same application pool.
I've made sure that EVERYONE can do ANYTHING to the files and directories in the application itself. I understand the security ramifications here, I'm just trying to get it working at all, and then I'll constrain the access rights afterward, one step at a time. But in any case, everyone can read those files.
Any help deeply appreciated. Thank you in advance.
The error is a .NET framework error so it finds the app, but there is a configuration error. What you could do is add some event logging code in APplication_Error handler in global.asax to trap these errors, or turn on health monitoring (<healthMonitoring enabled="true" />), which by default will log ASP.NET framework errors to the event log.
HTH.
Never got this working until I changed the application from a "sub-application" (I don't know the proper terminology) to an independent website with its own hostname. ASP.NET works in mysterious ways.

Cannot log on locally IIS [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
What causes this error, how can I fix it?
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x8007052e
Config Error Can not log on locally to C:\inetpub\wwwroot as user administrator with virtual directory password
Config File Unavailable (Config Isolation)
Requested URL http://192.168.0.3:80/
Physical Path C:\inetpub\wwwroot
Logon Method Not yet determined
Logon User Not yet determined
Config Source
<application path="/" applicationPool="PS-Extranet">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" userName="administrator" password="[enc:AesProvider:PrISRz2ggJH4bV46ktObfCSh91Y/yF9pAoLmH7eCnj0=:enc]" />
</application>
I had the same issue, but reason was different.
In my web.config there was a URL rewrite module rule and I haven’t installed URL rewrite module also. After I install url rewrite module this problem solved.
Looks like the user account you're using for your app pool doesn't have rights to the web site directory, so it can't read config from there. Check the app pool and see what user it is configured to run as. Check the directory and see if that user has appropriate rights to it. While you're at it, check the event log and see if IIS logged any more detailed diagnostic information there.
On Windows 10 I had to install ASP.NET 3.5 and ASP.NET 4.6 under Internet Information Services (the other boxes automatically check themselves):
Finally I get the solution for my problem. The asp.net account not appear in the IIS manager because I didn't check its check Box in IIS to do this in windows 7 follow the steps
Open control panel
Click on” program” link (not uninstall programs)
Click” turn windows features on/off” link
locate” Internet Information services IIS” in the pop up window and expand its node
Expand the” World Wide Web Service” node
Expand “Application Development Features” node
check the check box of”ASP.NET”
Then click ok button
Now you will see the Asp.net account on the IIS manager and by default you see IIS account Now you should move you asp.net website from “my document” to another place the IIS have permission to access it (to any partition on your computer) Now browse your website from IIS manager and it should work.
We got this error after having to change our domain administrator password.
After monkeying with several settings, I eventually found that in the application in below path as it was set to specifically use the domain administrator account rather than pass-through authentication (who knows why).
IIS Manager -> Basic Settings -> Connect
you need to do one step:
run->cmd
run "c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i"
Thats it
Experienced this issue today and resolved it. Someone had set the "Path Credentials" for the "Default web site" in IIS to run as a specific user. This same user changed her password either due to the password expiring or just a routine change. Setting the "Default website" to connect as the "Application User" via the basic settings option resolved it for me
you probably change your NT password.
Open IIS -> Right click on your application -> manage application -> advanced Setting -> physical path credentials.
good luck
In my case, this error appears after changing folder's solution.
I solve the problem by goin to my project properties and recreate my virtual directory.
Right click on project > Properties > Web > Under Servers section click "Create Virtual Directory"
It will display a message saying that the virtual directory was created in another place and it will change it
For me, I needed to enable Http Activation under the .Net features in "Add/Remove Windows Features"
Got this working alright but not based on suggestions above. My case is that am getting the 500 error running iis7 on a windows 2008 server in a domain. Just added a new user in the domain and basically allow read/execute access to the virtual directory or folder. Ensure that the virtual folder>basic settings> Connect As > Path credentials is set to a user with read/xecute access. You can test settings and both authentication and authorization should work. Cheers!
Default web site need to manage as well:
1 .On Default web site -> basicSettings -> connect as, change it to the right user.
2.change the Identiy of the applicationPool that related to the defaultWebSite
g.luck
Right now i had this error and resolved it. Your url could match with created virtual directory.
You have to check virtual directories, in my example i found in applicationhost.config next row:
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/admin/roles" physicalPath="C:\..." />
</application>
I tried to open page with an url (http://localhost/admin/roles) of AdminController and Roles action and got this error.
For others out there, I got a similar error message due to trying to run a .Net 4 app in a .Net 2 app pool. Changing the .Net FX version for the app pool fixed it for me.
I was having a similar error installing php 5.3.3 with the Error Code 0x80070020 with a direction to a few lines in web.config in my www root directory (not the standard root directory).
The solution, while crude, worked perfectly. I simply deleted the web.config file and now everything works. I spent HOURS trying other solutions to no avail.
If anyone thinks this was stupid, please let me know. If anyone else has spent the same amount of time pulling out hair, try it and see (after backing up the file of course)
Regards FEQ
Was having the same error and fixing the credentials in the IIS app pool did not help. I finally resolved the error in IIS by selecting my website under Default Web Site, Advanced Settings->Physical Path Credentials->Specific User, and reentered the credentials for the app pool user, then restarted IIS and the error went away and my website came up successfully.
As I got the 500.19, I gave IIS_IUSRS full access rights for the mentioned web.config and for the folder of the project. This solved the issue.
You can give permissions by
right click on the folder / file
selecting the tab "security"
add the user IIS_IUSRS - don't forget the i in front of USRS and don't write an "e" as in USERS
If it's bigin when you try to acces to joomla administrator panel, Just a username and password problem !! You have just to update a jos_user in your joomla database.
Go to your joomla web site directory and open a configuration.php with bloc note or note pad to show what database name your joomla administrator site use.
You have to find a line who have:
public $user = 'joomlauser251'; //MySQL username
In my case joomlauser251 is my DB name.
Login to your mysql:
mysql -uyourusername -pyourpassword
Select database for your joomla:
use joomlauser251;
Change password for admin:
UPDATE jos_users SET password=MD5(‘NewPassword’) WHERE username=’admin’;
And retry to acces again.
That’s all !!!
Didn't seem to be a permission issue for me - tried giving the IIS_IUSRS account full control over everything in the web service, just to see if this was the cause. The fix turned out to be recreating the application hosting the web service (i.e. the actual '.svc') in IIS
In my case, I found a reference to an old domain account password in applicationHost.config under Virtual Directory defaults.
so easy
find the file "applicationHost.config" in Windows -> System32 ->inetsrv -> config
1. backup "applicationHost.config" to another filename
2. open file "applicationHost.config" clear data and save
3. open browser and call url internal website , finished.
If you are using a new, dedicated, user account... It is also worth checking that the password for that account has not expired, as that will also cause this 500.19 permissions issue.
For ASP.NET Core websites, this generic error will also occur if you don't have the HttpPlatformHandler module installed, see this answer for more details.
ASP.Net applications come pre-wired with a handlers section in the web.config. By default, this is set to readonly within feature delegation within IIS. Take a look in IIS Manager
1.Go to IIS Manager and click Server Name
2.Go to the section Management and click Feature Delegation.
3.Select the Handler Mappings which is supposed to set as readonly.
4.Change the value to read/write and now you can get resolved the issue
I have just one more thing to say about this. With the same HTTP Error code, you can still have several different errors, as one of them has been posted here at the original question's description.
For example: after I've edited the Web.Config file of an ASP.NET project, I had
Error Code 0x8007000d
"Only one <configSections> element allowed. It must be the first child element of the root <configuration> element "
As it says, you must NOT insert your own XML stuff before the <configSections> part of the Web.Config file. After I've inserted my snippet after the end tag of <configSections>, it worked just fine.
My website's correct path was not specified in IIS.
My solution is that,
just delete the corrupted folder.
Then re-create folder again.
It seem that if the corrupted folder had been created before IIS
setup. If you created folder again, it will work correctly.
I got this error after uninstalling Windows Server Update Services (WSUS) from the computer running IIS. Apparently uninstalling WSUS may break the IIS configuration on the server making other web application installed on the same server unavailable.
I found the solution for the problem here.
In my case, the value of the Key was incorrect in Web.config file:
<defaultDocument>
<files>
<add value="Portal.htm" />
</files>
</defaultDocument>
when I change the value to "Portal.html" it worked.
I got this error after upgrading from Visual Studio 2013 to 2015. After a bit of searching and trying various fixes I found the problem can be resolved by removing the following from web.config:
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent >
Apparently staticContent is deprecated now?
Source
Edit 1
This sort of prevented IIS from serving .json files when the program was deployed. If you do this you're supposed to re-add .json (application/json) to the mime types of your site in IIS. Here is some more info: http://www.iis.net/configreference/system.webserver/staticcontent/mimemap
Edit 2
I noticed that in my situation the above edit 1 solution only works temporarily. Once I redeploy the entry gets removed. So, I moved the mimeMap XML into Web.Release.config. Works fine now.

Handler not yet determined error

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?

Resources