IIS serves ASPX but not ASMX - asp.net

Deployed an ASP.NET webforms application to IIS 6.0 64-bit server. Some associated DLLs are only available in 32-bit so I enabled 32-bit applications following these instructions. At first I was not able to view ASPX pages but I had forgotten to Allow the ASP.NET Web Service Extension. Sorted!
Recent testing has shown that a 404 is received when requesting ASMX web service files. From the IIS log the status code is:
404 0 2
Anyone have any ideas? I anticipate this being something silly like all 404s.
UPDATE 1
Not sure if this is related but the same error code is received when requesting PNG files. No problem serving JPG or GIF from the same folder... what!!!??? It is worth noting that if I change the extension of the image to JPG then it can be requested.
UPDATE 2
See answer below.

Okay found the problem.
C:\WINDOWS\system32\inetsrv\urlscan\UrlScan.ini did not have the PNG and ASMX extensions specified in the AllowExtensions list.
A nice quirk in our IIS server build!

Have you made sure that for .asmx file types, the handler is mapped to asp.net dll and that "check if file exists" is unticked within IIS?

I have changed connection pool to "Classic" from integtrated and it started working for me

Related

asp .net 4.0 app on IIS7 Error 404.17

I am having a problem setting up a website under IIS 7. I have created an application and the application pool for the application. Application pool is using .Net Framework 4.0 as my .net app is written in .Net Framework 4.0. Application pool is set to use classic Pipeline Mode. MIME Types have been automatically added to .asp & .aspx.
When I run the website windows explorer is showing me "View Downloads" and trying to download "application name localhost" when it downloads the file I notice that its the html of my default.aspx. I have checked Default Document and it contains Default.aspx.
If I remove .asp & .aspx MIME Types then I get an 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 have seen this problem many times. IIS is not serving aspx pages and most likely is not running for the entire server or that site.
For the entire server: Check to see if iis world wide web service is running.
For the site alone: Hit run inside IIS.
You can easily know if IIS is running properly by going to IIS and hit the browse option from inside a web site.
With the data you have put these are the things I would try in order if I were you:
Check in Server Manager/ Features if ASP.NET is installed (ServerManager/Roles/Web Server(IIS) look for ASP.NET
Check IIS Manager if everything is ok by:
Try to browse a test.html file to see if you are able to browse normal
Check Basic settings by clicking Test Settings
Check Handler Mappings to see if aspx is there.
Try to browse a sample test.aspx page with test data.
Check Application pool settings.
Reinstall Framework 4.0
Reboot machine ( a classical)
If you gave us more info and/or the ouput of my proposed tests maybe can help more. Good Luck :)
I had the 404.17 error happening on a server today. As you and cad mentioned, I checked the framework of the Application Pool that my site was using to make sure it was set to ASP.Net 4.0, and it was. What happened in my case is that my site was not using the application pool that I thought it was. My site was nested under another site, meaning my site pointed to a subfolder but another site was pointing to the root folder. Even though I had my site set to use the ASP.Net 4.0 Application Pool, the root site used a different Pool that had ASP.Net turned off, it was set to "No managed code". When I set the framework to 4.0 for the Pool the parent site was using, then my site started working.
In my case the solution was fixing the Handler mappings as explained here: http://forums.iis.net/post/1943489.aspx
IIS Manager->high-light you web site->click Handler Mappings icon on
the home pane->click Revert to Parent...
on the right Actions pane

Changing "Project Url" causes ASP.Net Web app to not be debuggable

I have an ASP.NET Web Application project that I am using to host a WCF Data Services (OData) project.
I went and changed the url from:
http://localhost/MyProject
to
http://localhost/v1/MyProject
after I did that I created a Virtual Directory for the new project URL.
Now when I run I get this error:
Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
I clicked help but it was no help (was IIS 6 level instructions, I have IIS 7). I did some googling and it was all fairly generic responses.
How can I get this working again? (Aside from revert to my old Url. Reverting works but I changed it for a very good reason.)
Your virtual directory need to point to the same scr directory you were originally debugging against.
Also, make sure the virtual directory is configured for Windows Authentication, which is required for debugging.
I had to go to my website in IIS and add a folder under it called v1. After I did that it all worked perfectly.

IIS returns 404 for ASP.NET MVC3 file (.cshtml)

I have standard ASP.NET 4 application. Inside this application there are also few razor (e.g. test.cshtml) files. ASP.NET application works however if I point browser to /test file (without extension). IIS (static file handler) returns 404.
The same application and even the standalone .cshtml files are working on local machine (with IIS7.5/Win7) and a server with (IIS7.5/Win2008R2), however it does not work the server with IIS7.0/Win2008.
MVC3 is installed on both machines, app pools on both machines are .NET 4.0 integrated.
How the .cshtml handlers works? When the IIS decides to use static file handler and when the .cshtml handler? What else should I check?
EDIT:
Clarification - I am not actually using whole MVC framework, it is just like plain-old .ASPX or PHP file. No controllers, no routes, no 'views'. I am using it for a simple script in addition to old ASP.NET application.
I think it is not a programming issue, since it works on local computer, but rather a configuration issue - the IIS on the Win2008 server might not be configured properly.
EDIT2:
(Machines with IIS7.5 works, only machine with IIS7.0 does not work. But I am not sure whether it is a problem of IIS version.)
EDIT3:
On my local computer where it works, I have not set any routing. TheCodeKing and Keith suggested that I need to have a routing somewhere. Maybe yes, but it is not in my application. It might be set by default somewhere in IIS configuration.
Do you have any hints where this 'implicit' routing could be found?
EDIT4:
Note: On all computers there is HttpForbiddenHandler for *.cshtml, since you cannot download the cshtml file. And there is also the TransferRequestHandler for *.. (Both are enabled.)
EDIT5:
I have found that on the servers, where it is working, I need to have any .cshtml file in the web root. If I remove the .cshtml from the web root and try to invoke any from a subdirectory it will not work.
EDIT6:
I tried that on another two machines: one with IIS 7.5 and another with IIS 7.0. On IIS 7.5 it works (plain install no configuration), but on IIS 7.0 it does not work.
How to make it work on IIS 7.0?
Yay! After several days of struggling I've found it! :))
One way to make it work on IIS 7.0 is to enable runAllManagedModulesForAllRequests:
<modules runAllManagedModulesForAllRequests="true" />
(Although, on IIS 7.5 it works even with the default value runAllManagedModulesForAllRequests="false".)
Don't ask me why:) Maybe someone can explain that.
Not sure if this is your particular problem, but it sounds like ASP.NET Web Pages isn't running (MVC 3 and up depend on Web Pages for Razor and other things). Sometimes things can get installed in orders that mess up some configuration of ASP.NET and IIS, which in turn could make it so Web Pages isn't running and no cshtml file will get executed.
Try running aspnet_regiis /i to clean it all up.
There is an hotfix for IIS7.0 available at: http://support.microsoft.com/kb/980368
I installed it today on windows 2008 SP2 (which requires an OS restart).
The behavior in IIS 7.0 is now similar than IIS 7.5
It fixed the problem on my side / without forcing:
<modules runAllManagedModulesForAllRequests="true" />
This is a better approach than running all modules for any request (even on css/images/...) which would cause unnecessary overload.
Are you sure that IIS has sufficient permissions to access the file under the /test directory?
This could cause some silly issues as I've found.
If this is an asp.net 4.0 web application, you will need to manually set up routes, create the appropriate controller(s), and make sure that your views (.cshtml files) actually exist in the /Views/ControllerName folder.
I would also recommend setting up your project to use IISExpress in your development environment to more closely match your web server. It's a great help when debugging these sort of issues.
As you aren't using MVC, you would need to set up routing, or rewriting using IIS rewrite module to expect /test to resolve to /test.cshtml. You won't get this behaviour without it.
e.g. something like this in your application start.
routes.MapPageRoute(
"extension-less paths",
"{view}",
"~/{view}.cshtml"
);
cshtml can work, if you set a web.conf.
You can think it is a html but with razor syntax.

can asp.net routing 3.5 sp1 do this issue?

I have a folder(/MyFolder/) with a dedicated web.config in it that does an impersonating
In that folder I have an asp.net file that use Microsoft report viewer 8.0 named MyReport.aspx
When I view this folder on my machine, it's working perfectly without issue
When I publish my project to the dev server and I'm trying to view the report, I have an issue where the the user that run IIS doesn't have access to something, (rsAccessDenied)
Can asp.net routing cause this issue?
(I'm not at work right now so I can only go by memory so it will be hard to provide more information)
Your impersonation is probably not set up correctly. Check the User.Identity.Name when running locally and on the server.
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user.aspx
In the end, asp.net routing was causing this issue, the web.config wasn't getting loaded.
I had something like this:
http://ip/myreport.aspx
I had to change it to
http://ip/reports/myreport.aspx
I had to have the folder in which the web.config was located in the url

ASP.NET gone FUBAR on a production machine

Today we tried to put an ASP.NET application I helped to develop on yet another production machine. But this time we got a very weird error.
First of all, from all the ASP.NET pages, only Login.aspx was working. The rest just show a blank screen when they should have redirected to Login.aspx. The HTTP response is 200, but no content.
Even worse - when I try to enter the address of some inexistent ASPX page, I also get HTTP 200! Or, when I enter gibberish in some existing ASPX page code (which should have been accessible without login) I also get HTTP 200.
If I enter the name of some inexistent resource (like asdasd.jpg), I get the expected 404.
The redirect to login page is written manually in Global.asax. That's because the application has to use some alternate methods of authentication as well, so I can't just use Forms Authentication. I would suspect that Global.asax is failing, if not for the working Login page.
Noteworthy facts are also that this machine is both a Domain Controller and has SharePoint installed on it. Although the website in question is listed in SharePoint's exception list.
I would check the following:
Is the application within a virtual application or its own site and not just a virtual directory?
Does the application have it's own App Pool? If it does not then is the app pool shared by apps in a different .net version.
Is the .net version of the application the correct one? 1.1 or 2.0?
Do the files in the file system have the correct permissions to be accessed via IIS?
Have you performed an IIS Reset?
Create a stand alone test.aspx page within your folder that just displays the date/time and check it works.
Make this single test.aspx page perform an exception (eg. divide by zero) and see what the outcome is.
More information required.
What Op Sys?
What mode IIS running under?
What version of .Net?
What version of SharePoint?
(Why are you using your DC as a web host?)
Does it work on the other production machines you've deployed to?
If so what is different between this machine and the working ones?
Did you deploy the same way?
Are you sure your hitting the right machine?
Are you sure your hitting the right web site?
What ISAPI components are installed globally and for the web site?
Is .aspx mapped to the ASP.Net ISAPI filter?
Do you have any HTTP Modules or HTTP Handlers configured?
Can you change the global aspx to write out some messages so you can be sure the piece of code you interested in is reaching?
Anything coming up on the IIS log or the event logs?
Addition:
What version of .Net?
By the sounds of it the .jpg request is being dealt with by IIS directly which is why you get the 404, but the .aspx request is being dealt with by something else which except for you login page, is always returning 200.
Assuming .aspx is wired correctly to .Net the the order of processing is based on ISAPI filters (high to low then global before site), then the ASP.Net ISAPI Extension (sorry I said this was a filter earlier but it's actually an extension). Then we get into the ASP.Net pipeline based on your .Net configs, and calls the HTTP Application (which includes your global.asax code), any HTTP Modules followed finally by a HTTP Handler. Your ASP.Net web forms are just fancy HTTP Handlers.
However, the request can be responded to and terminated from any point.
Since your code works on other machines though, I'm tempted to point a finger at SharePoint if it isn't installed on the working machines. Is this SharePoint 2007? That is also an ASP.Net application (I don't think 2003 was).

Resources