If I go to the root of the app:
http://localhost:31503
I get a 404.
If I go to a subpage:
http://localhost:31503/User/Reset
I also get a 404.
I'm thinking this might have to do with my previously deleting and re-adding it in IIS; maybe there was some setting I had set to make it work and now that I recreated it from scratch that setting is no longer set? But what setting could it be?
edit: if I change this setting in IIS: .NET Compilation > Default Language from VB to C# then I get a blank page instead of a 404 for http://localhost:31503 and the expected behavior for http://localhost:31503/User/Reset... or not? now it's not working again, maybe I accidentally ran it in Visual Studio? Or maybe trying to access it via https to test that out broke it...
I also noticed that my app's favicon does appear in the browser, so it's not like nothing at all is there... And if I run it in Visual Studio (ctrl-F5) it runs just fine, provided that I disable the app in IIS where it is using the same port.
I have created an ASP.NET Web Forms Web Site in VS2013
This includes items such as WebGrease and BundleOptimisation
Everything is working perfectly locally on my machine.
But when I publish the website to the actual server, all of the CSS is not being referenced and accessing pages without the .aspx stops working (eg /dashboard instead of dashboard.aspx)
I am running IIS7.1 on the server
Any help would be fantastic. I can't find a solution to this anywhere on the internet but maybe I am typing the wrong search terms!
I found the issue after scouring through solution after solution.
You change "<'module>" to in the <'system.webServer> part of the web.config file
That gets the Rewrite working.
And set debug=true in <'compilation debug="true" targetFramework="4.5">
So that the CSS works ...
It took so long to fine!
I have a problem with caching of aspx and ascx files in one of my web applications on localhost (windows 7). If I make changes to one of these types of files, for example changing a hardcoded text, no browser picks up this change. I have tried ctrl+f5, and clearing the browser cache. Recompile doesn't help either since no code changes has been done. The only thing that helps is resetting IIS.
I have another web application running on the same IIS instance, where I don't experience this behavior. However, I can't figure out what the difference between those two applications is. I don't publish any files, the IIS sites are pointing directly to the files I edit in Visual Studio.
Any ideas?
For some reason this fixed it self when we went from Subversion to TFS this week.
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.
I faced some problems after hosting my web project in IIS 7 / Windows 2008. Images are not shown when I run the project on my browser.
I copied my project folder (webtest) to c:\inetpub\wwwroot\. To be sure, I chose image from webtest\image\sample.jpg again. It works properly when I run it. However, after putting up for hosting and I call it from browser it doesn't show the image.
What are the possible causes of the problem?
Possible solution is to add .jpg/.jpeg mime type in IIS Manager if it doesn't exists.