Script not served by static file handler on IIS7.5
Asked Answered
S

22

136

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.

Skillet answered 21/9, 2010 at 16:15 Comment(1)
Alternatively do it in web.config as explained here #2062178Stayathome
C
127

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.

Cavallaro answered 21/9, 2010 at 18:43 Comment(7)
There are two IIS Registration Tools that ship with the .NET Framework; one for standard systems and one for 64-bit system. The tool for 64-bit systems in located in the Framework64 directory of the Microsoft.NET directory inside the Windows folder; for example C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727 would contain the IIS Registration Tool.Oaxaca
If you get the error the command is not recognized as an internal or external command. Run it in Developer Command Prompt.Cembalo
I had to do this for the 2.0 framework in the Framework64 folder. like what @matthew Lock saidVitric
Also of note, if you must run 2.0 and 4.0, run 2.0 first.Methodist
C:\Windows\Microsoft.NET\Framework64\v2.0.50727 (for v2.0 on x64) - change Framework64 to Framework for x86, change v2.* to v4.* for v4 (browse to parent folder for exact name)Arian
I have a .NET 1.1 app and I tried run this command inside v1.1 folder, it didn't work but when I run it inside v2.0 folder it worked.Chine
Windows 10: Start installing ASP.NET (4.0.30319.0). This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see go.microsoft.com/fwlink/?LinkID=216771. Finished installing ASP.NET (4.0.30319.0).Deputize
D
66

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.

Windows Features Panel

Destructive answered 6/1, 2014 at 14:39 Comment(3)
This worked for me with IIS 8.5 and Windows 8.1. I needed to enable a ASHX getting the error described in the question (HTTP 404.17)Octavla
THANK YOU! This worked for me. However, in my case I had to turn it on for .NET 2.0 since I am using old Web ServiceIncrease
This is an old post but your solution saved my bacon. I would not have found this in a million years...anywhere else. Thank you.Jane
O
63

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.

Obidiah answered 17/2, 2011 at 14:7 Comment(2)
Note to others, I think on webapps that use 4.0 app pool, you'll need to run aspnet_regiis againEnclave
For .Net 4 its in the parent directory. E.g: C:\Windows\Microsoft.NET\Framework\v4.0.30319\ServiceModelReg.exe -iFulsome
V
48

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.

Vidette answered 6/2, 2012 at 15:53 Comment(3)
As answered by Adi: this commando does just all that: c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -iLeeland
Thank you @Vidette for the tip! IIS > Sites > acme.com > Handler Mappings > Revert to Parent. In my case, I did it for the entire domain and not just "staticFile". This worked for me and was simpler/preferable than running an executable (aspnet_regiis.exe). Why isn't this suggestion bubbling further up? =)Squarerigged
Brilliant tip... but where the heck did that showstopper come from ? I don't remember ever meeting that in previous versions of IIS...!Collapse
K
27

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:

enter image description here

You can find the menu item "Add Roles and Features" in the menu "Manage", in the right corner of Server Manager

Kinescope answered 19/4, 2013 at 23:6 Comment(1)
Menu item "Add Roles and Features" you can find in the menu "Manage" in the right corner of Server ManagerCarpenter
S
16

alt text

should check out this option i suppose

Stockroom answered 21/9, 2010 at 16:24 Comment(1)
That just sets whether static content can be served or not. My problem is that script requests are being mapped to static content. If I turn it off, IIS doesn't even attempt to server the page, just giving me a blank.Skillet
D
16

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

Declaration answered 24/1, 2014 at 16:57 Comment(3)
All you have to is enable static content feature for IIS. This has nothing to do with WCF.Skillet
@Skillet depends on why you're getting that error, different causes result in the same error - if you're getting the error with an SVC file configured to use WCF, the above fixes it.Arian
LOL totally agree, porting several sites and just seen 5 different kinds of error all with no actual error message or a very cryptic one. Example "The page cannot be displayed because an internal server error has occurred" means you have added a static content mime type that is already existing.Hydrous
D
14

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).

Disentwine answered 22/2, 2013 at 11:28 Comment(1)
@Disentwine for the image, you could share a link after uploading that somewhere, e.g. on imgur.comLeggat
A
12

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.

Anguiano answered 21/12, 2012 at 8:40 Comment(0)
J
9

Register asp.net again....will solve the issue.
enter image description here

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

Joshia answered 17/12, 2012 at 15:30 Comment(1)
aspnet_regiis.exe -i responds with "This option is not supported on this version of the operating system." Why is IIS such a pain in the ass?Aerotherapeutics
O
5

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.

Osteomalacia answered 7/3, 2013 at 22:22 Comment(1)
Server 2012, IIS8 here also, thanks for the pointer you got me going in the right direction. For those interested, I required turning on Application Server role as well as Web Server Role. I found the info I needed here: msdn.microsoft.com/en-us/library/hh167503(v=nav.70).aspxFruge
F
4

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

Fold answered 14/5, 2013 at 19:12 Comment(0)
R
4

For Windows 10/Framework 4.7, I had to turn on HTTP Activation through the following method:

  1. Control Panel > Programs and Features > Turn Windows Features on or off
  2. 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
  3. Click OK and let the install do its thing, then open an administrative command prompt and issue the IISRESET command
Ringo answered 5/6, 2018 at 14:16 Comment(0)
S
3

cmd -> right click -> Run as administrator

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Stambaugh answered 24/3, 2015 at 13:7 Comment(0)
P
3

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

Pulsifer answered 3/1, 2017 at 21:7 Comment(0)
H
2

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.

Haydeehayden answered 5/2, 2013 at 16:21 Comment(0)
D
1

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

Dynamometry answered 5/1, 2013 at 13:44 Comment(0)
A
1

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.

Asuncionasunder answered 20/10, 2017 at 15:50 Comment(1)
You are a beautiful person. This actually was the problem..and something we overlooked on our installation.Twilatwilight
I
0

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

Ironclad answered 16/9, 2013 at 23:35 Comment(0)
F
0

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

Fanchie answered 12/2, 2014 at 19:21 Comment(0)
C
0

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.

Coaler answered 28/7, 2014 at 14:18 Comment(0)
A
0

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

Arterio answered 15/5, 2017 at 14:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.