Script not served by static file handler on IIS7.5 - asp.net

I've just tried to deploy my first web application to IIS on my Windows 7 Home Premium notebook. After creating the application, I had to change to the Classic App Pool, then set that pool for framework 4.0. Now I get the following error:
HTTP Error 404.17 - Not Found The requested content appears to be
script and will not be served by the static file handler.
The requested URL is http://localhost:80/pvmms/default.aspx
I'm afraid extensive Googling has yielded nothing clear or definite enough for me to work with and as usual I've turned to the experts.
EDIT:
I suspect this is because there are no framework 4.0 handler mappings for .aspx files. However, aspnet_regiis even gives my admin user the finger and says I need admin rights to run it.
EDIT #2:
I registered all the frameworks (2 & 4, 32 and 64) and all now works. I found this by manually adding a script map for .aspx to aspnet_isapi and voila. I don't understand why the installation of the framework doesn't do this, unless my memory fails me and I only enabled IIS after installing VS.

Maybe too late now, but more often than not you need to run
aspnet_regiis.exe -i
after installing asp.net. Maybe I would do it anyway now.

In addition to above, if you need WCF support, you might need to run this:
c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i
Replace v3.0 to whatever your current framework version is.

I encountered this error from IIS 8.5 when trying to access a WCF service I had written. Turns out the server didn't have the WCF HTTP Activation features turned on. Checked the boxes and clicked through the wizard, iisreset, started working.

If you are using iis 7.5.
Just go to IIS Manager, open your website properties.
You will see 'Handler Mappings' section there, just go to that section and Search for 'staticFile'.
Most probably its a last file in the list.
Then Right Click on it and Select 'Revert To Parent'.
I have wasted so many hours while i have faced this first time, anyways this will solve your problem.

I had this issue with Windows Server 2012 with ASP .NET 4.5 you can't use aspnet_regiis.exe, and just have to install ASP .NET 4.5 via the Add Roles and Features Wizard:
You can find the menu item "Add Roles and Features" in the menu "Manage", in the right corner of Server Manager

should check out this option i suppose

I solved this problem by enabling WCF Services
Programs and Features > NET Framework 4.5 Services > WCF Services> HTTP Activation node
But you have to admit it guys this ENTIRE IIS setup configure/guess/trial and see/try this/try that spends 4 or 5 of our days trying to find a solution around approach IS A COMPLETE AND UTTER JOKE.
SURELY, 'IIS' IS THE BIGGEST CONFIDENCE TRICK EVER PLAYED ON MANKIND TO DATE

I know this is an old question, but I've just had this with a 3.5 application on my rebuilt Windows 8 machine and I was still getting this after aspnet_regiis -iru and it turned out the be ASP.NET 3.5 wasn't ticked within Application Development Features (not enough reputation to post an image).

There is a chance that application pool created for you application by default is version 2. So although you see a handler for .svc extension in the list it does not work and treat it as static file. All you need is to open application pool properties and switch it to version 4.

Register asp.net again....will solve the issue.
Go to Visual Studio Command Prompt, And register asp.net as windows\microsoft.net\Framework[.Net version num]\aspnet_regiis.exe -i

I had this same issue on a windows 8 machine I am setting up. I had installed vs2012 before vs2010, which installs .NET framework 4.5. I have my app pools running in 4.0. I made sure I had aspnet registered for 4.0 using aspnet_regiis -i. That still didn't do the trick. Then I opened up the Windows Features and noticed that 4.5 added a set called ".NET Framework 4.5 Advanced Services". I enabled the WCF Service node and its children and then my svc endpoint operated correctly. Hope this helps folks who are making the move to Windows 8.

I stumbled upon this question when I ran into the same issue. The root cause of my issue was an incorrectly-configured app pool. It was set for 2.0 inadvertently, when it needed to be set to 4.0. The answer at the following link helped me uncover this issue: http://forums.iis.net/t/1160143.aspx

For Windows 10/Framework 4.7, I had to turn on HTTP Activation through the following method:
Control Panel > Programs and Features > Turn Windows Features on or off
Under .NET Framework 4.7 Advanced Services, expand WCF Services, select to check the HTTP Activation and whatever else you need when working with WCF
Click OK and let the install do its thing, then open an administrative command prompt and issue the IISRESET command

cmd -> right click -> Run as administrator
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

For other people reading this:
This can happen is if the .Net version that you have registered isn't the one selected under the 'Basic Settings' of the application pool attached to your website. For instance, your sites application pool has .Net v2.0 selected but you registered v4.0

Just another possible solution I found having the same error message.
When trying to setup a .NET 4.0 web application to a new applicition pool I was receiving this strange error telling me it was trying to process my aspx file with the static file handler, which didn't make sense.
For some reason the ISAPI for .NET 4.0 was set to disabled in the ISAPI and CGI Restrictions area of the server level in the IIS manager. Setting it to enabled was all that was required, however the IIS 7.5 manager is so convoluted and hard to follow it took me a long time to figure this out.
I'm guessing that since it was a 4.0 Application that could not be processed by the 4.0 Engine the static file handler was being used by default.

I had the same problem. When I added Static content feaute for IIS, It works fine.

it could be multiple reason, in my case under Application pool->advance setting->Enable 32 bit application (should be true).It was set to false before.

Using IIS manager, I found that .aspx files were mapped (under "Handler Mappings") to ISAPI 2.0 - even though ASP.NET 4.5 had been previously installed. Editing them to point (also) to an executable for ISAPI 4.0 64bit fixed the issue.
The executable was found in
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll

i received this message for an application on iis 7.5 with a classic app pool assigned to .net 2.0. i needed to go to Handler Mappings and add two script maps, both were the same with except for the name. one name was svc-ISAPI-2.0-64, the other was svc-ISAPI-2.0. The request path was .svc. And the Executable was %SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll. i restarted iis and all was happy

One of the worst case scenario I just solved is - having conflicting entry in Web.config.
On my local machine I didn't had .woff extension registered in IIS, so I added it using Web.config. But on production server .woff had mime type registered. This caused application level conflict.
Funny part is there are no error logged for this. Just a guess work (first time of course).
So for me solution was just to remove and/or elements from web.config.

I had the same issue, I just changed the target framework version on the website to the version it is developed in,Same in IIS. This solved my problem. Hope this helps...
Thank You

Related

IIS7 MVC Routing Not Working

Our company ships an MVC based product (targeting v4.5) which has stopped working on a customer site for what appear to be environmental issues - a build which worked with no problems once upon a time now gives a 403.14 - The Web server is configured to not list the contents of this directory.
.
What I think is happening...
The user accesses http://server/AppName
Because it's an MVC app, the default route (Reports/Index) should be used.
Instead IIS is looking for a default document...
... and, not finding one, it assumes the user wants to list the contents of the directory...
...which is not enabled so it throws a 403.14.
.
What I've tried so far...
Accessing the route directly.. results in 404 error. So I'm pretty
sure IIS doesn't realise it should use routing.
Use aspnet_regiis to register ASP.Net with IIS. This was done from the Framework64 folder since...
OS is 64 bit - Windows Server 2008 (Standard without Hyper-V)
IIS is 64 bit - though Enable 32-Bit Applications is true
Checked AppPool is targeting v4 of the framework - it is.
Changed AppPool mode to Classic - was pretty sure it should be integrated but was worth ruling it out. It is now back to Integrated
Confirmed RunAllManagedModulesForAllRequests is set to true in the web.config.
Checked permission conditions defined in <system.webServer> section of web.config are met - they are.
Created the simplest of MVC applications and deployed it - same problem.
Running the command shell as Administrator unregistered ASP.Net using aspnet_regiis -ua and re-registered using aspnet_regiis -enable -i. We hit a couple of permission problems - and the Temporary ASP.NET Files directory was missing but once they were address we were back to the same error.
Added a simple default.htm - when present, this is served in response to the http://server/AppName request.
I'm clean out of ideas and all google hits suggest some combination of the above - or enabling directory browsing (which I think is just a symptom rather than the root cause).
Also, not sure if it's relevant but the amount of configurable elements available for the application in IIS seems a bit below what I would have expected...
Have you Checked the user the application pool process is running under? I think Your site needs to run with permissions to execute the .net libraries and I've seen this just change for seemingly no reason (probably related to an overzealous update to the system).
You can try with the Enabling directory browsing .
assuming you are under Windows Server 2012 or Windows Server 2012 R2
On the taskbar, click Server Manager.
In Server Manager, click the Manage menu, and then click Add Roles
and Features.
In the Add Roles and Features wizard, click Next. Select the
installation type and click Next. Select the destination server and
click Next.
On the Server Roles page, expand Web Server (IIS), expand Web
Server, expand Common HTTP Features, and then select Directory
Browsing. Click Next.
On the Select features page, click Next. On the Confirm installation
selections page, click Install. On the Results page, click Close.
if you using the Windows PC try this in your command prompt as follows:
go to C:\Program Files\IIS Express
then press Enter:appcmd set config
/section:system.webServer/directoryBrowse /enabled
Maybe this is your case https://forums.iis.net/t/1157304.aspx
SQL Server Reporting Services creates a folder called Reports by
default if you install it on IIS. If you install SQL 2008 then
Reporting Services doesn't need to use IIS and instead will try to
reserve the URL with the HTTP.Sys service.
I believe this is the cause of the conflict you are seeing. What you
could try is changing the URL that Reporting Services uses via the SQL
Server Configuration Wizard.
Also I found that
Report Manager of SQL Server can use reports path http://<server name>/reports
Configure a Native Mode Report Server for Local Administration (SSRS)
I think the problem is IIS features that are not installed yet. I have met this kind of problem frequently in Windows Pro. Make sure to turn on every feature under Internet Information Service -> World Wide Services because by default IIS is configured to use WebForms. So there might be some features that not installed yet to use MVC, especially ISAPI filters. In my case, that was the solution. I hope it helps.
Something similar i encountered using VS 2017 & ASP.NET MVC.
Was working on the project for long with no problems at all but suddenly the routing started misbehaving & stopped working.
So I changed the Port in Project Properties Page & it started working.
I really don't know what is the relation between a port & MVC routing modules. Someone else can enlighten if at all this helps.
I had the same problem and I just created an application pool out of the Default Web Site in IIS and stoped the default web site. With that difference you will not have the application pool's path
I know it's been a long time since this question but i've had the same problema recently. I've tried every single configuration, just like #amcdermott did, but the only action that solve the problem was reinstalling .NET Framework.
My app was built under .NET Framework 4.5.2. The application server had the version 4.6.1 and 4.5.2 installed. So, i uninstalled all framework versions and installed the one that i needed.
Please, make sure that no other applications use superior versions of .NET Framework if you going to try this solution.
Here are some quote I find on Microsoft official site which I think may help:
For site administrators
This problem occurs because the Web site does not have the Directory Browsing feature enabled, and the default document is not configured. To resolve this problem, use one of the following methods:
Method 1: Enable the Directory Browsing feature in IIS (Recommended)
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Directory Browsing.
In the Actions pane, click Enable.
Method 2: Add a default document
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Default Document.
In the Actions pane, click Enable.
In the File Name box, type the name of the default document, and then click OK.
Method 3: Enable the Directory Browsing feature in IIS Express
Note This method is for the web developers who experience the issue when they use IIS Express.
To do this, follow these steps:
Open a command prompt, and then go to the IIS Express folder on your computer. For example, go to the following folder in a command prompt:
C:\Program Files\IIS Express
Type the following command, and then press Enter:
appcmd set config /section:directoryBrowse /enabled:true

The requested content appears to be script and will not be served by the static file handler.IIS 7.5

I know there are related posts here on this forum and another resources but I got stuck with this and couldnt proceed.Problem is i've done a website with vs2010 when i publish it to ftp server and navigate to url adress I got this error. Here the things that i've done
-I've enabled IIS services and static content
-I've revert to parent the staticFile under handler mappings
-I've registered the asp.net again in command prompt(the regiis.exe thing)
-In IIS manager i've added my website adress under sites, stopped default web site and started mine.
-I've added my site to classic.NET AppPool(integrated,and v4.0)
-I've enabled the default browsing..
-I've done all the advices that generally covered..
Here is my web.config
<configuration>
<system.webServer>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" />
<defaultDocument>
<files>
<add value="AnaSayfa.aspx" />
</files>
</defaultDocument>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
where am I doing mistake? I've spent 2 days and couldnt proceed an inch.I will burst into tears if this problem solved.Any help will be greatly,greatly,greatly! appreciated,will be my hero,master (: thanks
Go to Command Prompt and install / repair ASP.NET
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
Go to IIS => Select the Server Name (System Name)
Go to ISAPI and CGI restrictions
Allow the Not Allowed restrictions.
I got this working when i change the app pool's .Net framework version to my application's .net framework version.
My application's framework version was 4.0 but app pool's setting was defaulted to 2.0. I had to change it to 4.0, then it worked fine.
+1 with #Dablue, IIS 8.5 does not support the aspnet_regiis command anymore. For me, the issue is resolved by installing the "Asp.Net 3.5" or "Asp.Net 4.5" under
Web Server > Application Development.
#regeme - I was experiencing a similar problem when trying to run my own site and after a lot of digging I finally resolved it. In my case it was related to a *.json file trying to be loaded and no rules being initialized for it. If you look closer at your error it should give you an idea of what it is IIS is not loading.
After looking at the web inspector's network tab I was able to see which items were returning 404's they were all *.json.
I'm assuming since your error is returning a "content appears to be script and will not be served by the..." it is the same case.
My resolution:
A) It is possible you have already done this as it would throw another error, I'm just covering our bases.
Go to IIS HTTP Response Headers
create a mime-type ".json" "application/json"
B) **SEE NOTE
Go to Handler Mappings.
Set Request Path: to "*.json"
Executable: to "C:\Windows\System32\inetsrv\asp.dll"
C) You may want to restart your service at this point again just to be safe this can be done in the IIS panel or cmd prompt.
Windows key + r
type: cmd and hit ctrl+shift+enter
type: iisreset and hit enter
*NOTE: This may save you a lot of headache, in my case I installed the 64 bit dll of asp.dll instead of the 32 bit version the folder for the 64-bit version is in C:\Windows\SysWOW64\inetsrv\asp.dll
IMPORTANT these file locations are in windows 8 and to my understanding are the same in windows 7 but this may not be the case for your OS double check.
Lastly if you are missing the asp.dll this is simply because you are missing windows features. Simply go to add/remove programs (Programs and Features)
Turn Windows features on or off
drop down Internet Information Services
drop down World Wide Web Services
check Application Development Features make sure it's not just a partial check and that all sub-items are being installed
On Windows 2012 and IIS 8.5 aspnet_regiis is no longer valid.
Instead, add the aspnet-4.5 rolefrom within server manager
Open server manager
in the left column select IIS
Scroll the right window until you see "Roles and Features"
Tasks select Add roles
Under "server roles" open "Web Server (iis)
open "Web Server"
open "application development"
Select "ASP.NET 4.5" (the "asp.net 4.5 extensibility" will not do it)
We got the same issue when hosting our MVC application on the web server. All the applications were working fine except the WCF service.
It was resolved, when we added a server role for .NET Framework 4.5 WCF service in Windows Server Manager.
Visit http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2013/02/08/how-to-enable-and-use-net-framework-3-5-and-4-5-in-windows-server-2012.aspx
For me the issue was fixed by right click on Virtual directory-->convert to application
Check out this, in my case this solved the problem
https://support.microsoft.com/en-us/kb/2019689
This might help you
In this case, a 404.17 error is returned if the *.aspx resource being requested from the site is handled in an Application pool that is not running in Classic Mode, is not 32 bit, or is not running the 2.0 version of the .NET Framework. In order for the resource to be served correctly in this example, all 3 pre-conditions must be met. Specifically, the application pool hosting this resource would have to be configured for Classic Mode, it would need to be configured to use the 2.0 version of the .NET Framework, and it would need to be set for 32 bit applications.
I had to create a new Web Site. There was some invalid configuration in my Website level that referenced my application's virtual directory directly.
For example, https://server/app gives me the 404.17 error but https://server/app-test works successfully. Swapping the two application names (using appcmd) caused the working app-test (now renamed to app) to begin failing. After creating a new Web Site named MyApp Web Site I was able to again create a new app, this time named app that worked successfully.
After extensive review of Default Web Site we cannot identify what configuration is causing 404.17 for apps named app and not alternatively named apps like app-test.
I believe the ultimate cause of this, is I did not have .NET Extensibility Services and ASP.NET 4.5 added through the server roles and features—During installation. Thus, the installer of my app failed to successfully configure Default Web Site correctly. For example, the created app pool incorrectly installed with v2.0 Integrated and not v4.0 Integrated. After installing the required roles and features I verified ISAPI (64 bit v4) was configured correctly, and the App Pool was appropriately configured for v4 Integrated. Unfortunately, I cannot identify any additional settings that would cause this issue—especially explicitly targeting the app virtual path.
This solved the issue for me. +1 to all who spoke a reasonable solution without having to pass through a 3 ring circus.
Turn on IIS Windows Features like these

404.17 error - requested content appears to be script

I have a similar question to this one;
IIS 7.5
Server 2008
ASP.Net 4.0 web site
The error I get when trying to run the site is this:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
...
Most likely causes:
The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different hander.
Now here comes the weird part:
THE WEIRD PART
The weird part is that on the develop server -- which is similar in every aspect to the production server -- everything runs smoothly.
Here's a list of things I cannot try, because I don't want to mess with the sever (it hosts many other sites):
Reinstalling .Net
Reinstalling IIS
Reinstalling anything
Running aspnet_regiis
Here's what I did try:
Republishing the site
Restarting the application pool
Changing the application pool to .Net 2.0 and back to .Net 4.0
Switching around between Integrated and Classic pipeline mode
Enabling 32-bit mode
Taking a look at Handler Mappings
Eventually I created a new application pool, and it sort of started working.
Q) "Sort of"?
A) Yes, sort of.
Now the site only works when the (new) app pool is set to .Net 4.0, Integrated,
and the site's Authentication has ASP.NET Impersonation set to Disabled.
Any change to these settings sets the server yelping "404.17" all over again.
Q) What's wrong with that?
A) What's wrong with that is that I NEED ASP.NET Impersonation for the site to function properly.
As always, your guidance is most needed.
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Usually this error occurs when you have the right IIS version installed to the respective .net framework. If it was a version (not installed) issue then you would have got a different error message. Anyways, I think by now you have resolved your matter, but I like to share some words with anyone else having this problem. These error messages gave me so much headache all last week and I had tried everything.
Best remedy is always to re install the latest .net in latest visual studio. And the important thing to do is uninstall the existing IIS(express or whichever you have) and re install it first. Then download the latest visual studio. This way visual studio installation can easily access you IIS and add the necessary application pool.
As for the error 404.17, it could simply be because the right application pool has not been assigned for the appropriate dot net version. If the right version is not there re installing visual studio is the only way I know. Also, I think you can try downloading another version of the Visual Studio too. For eg, download the ultimate if you have professional or vice versa. Hope this helps someone with similar problem.
Installing this windows server feature http activation is, what was missing for me.

Upgraded to .NET Framework 4.0 - Site down

Upgraded server Framework to 4.0. Using Godaddy hosting. The website is now showing this error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
On searching the internet found this:
Error message when you visit a Web site that is hosted on IIS 7.0: "HTTP Error 500.0 – Internal Server Error"
The link above says:
Resolution 2
Make sure that the server that is running IIS 7.0 can access the configured root directory of the requested location.
I am not sure what to do.
Is your Application Pool running on .NET 4.0 or .NET 2.0?
http://technet.microsoft.com/en-us/library/cc754523(WS.10).aspx
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
On the Connections pane, expand the server node and click Application Pools.
On the Application Pools page, select the application pool for which you want to specify a .NET Framework version, and then click Basic Settings in the Actions pane.
In the Edit Application Pool dialog box, in the .NET Framework version list, select the version that you want the application pool to use or select No Managed Code if the application uses only native code.
Click OK.
Moving from comment to answer so answer may be marked for future reference
Not sure if this would help, but it's an issue I ran into when upgrading to .NET 4. The person who had managed the site before me had used IIS manager to configure settings and it added references to .NET 3.5 in the web.config. Removing all references/assemblies related to 3.5 and below fixed the issue.
This can also happen if you are using third party controls like Telerik or if something is wrong in the web.config file. Try to remove the httpHandlers/httpModules from web.config file and if this solves the problem, you can add them one by one to check which handler/module might be causing the problem.

Cruisecontrol.NET & IIS7 Static File Handler Problem

I'm trying to get Cruisecontrol.NET running with Server 2008/IIS7 and when I try and navigate to the dashboard I get the following error:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
I'm a bit lost in IIS7 so it could be something pretty straightforward. They (cc.net) do some funny stuff with http handlers in the web.config which may be related to the problem:
Anyone have any pointers?
Is the dashboard set up as an application in IIS?
I've not used IIS7, but I know in IIS6 you need to enable an application and assign it to an app pool before you can run ASPX code.
EDIT: This works in IIS6.
Open the IISAdmin tool on the web server. Expand the web sites folder. Find the virtual directory (directories?) for CruiseControl. Right-click on it and look at properties. On the directory tab, create a new application and give it a suitable name. Enable the application to execute "scripts only". Assign it to an application pool (you may want to create a new one just for this application -- consult the help documentation for this). You may also need to change the ASP.NET version You can do this on the ASP.NET tab -- choose either v1.1 or v2.0, whichever CruiseControl requires.
In Vista, go to Windows features in the control panel. there is a section there for IIS and you will find the scripting setting under the IIS 6 compatibility section
I just had this same issue when I installed CCNET 1.5 under Windows 7/IIS 7.5
You need to configure the app pool for the ccnet site. Under the Basic Settings for the application pool, set 'Managed pipeline mode' to 'Integrated'.

Resources