I have a Windows Server 2012R2 running IIS version 8.5.9
Currently it has a single ASP.net Forms web application running on the default http port 80.
The website has an application pool (v4.0 Classic).
The website files are stored in c:\inetpub\wwwroot\formsApp.
( The application can be accessed in a way similar to: http://server-host-name.company.com )
This works fine, with no issues.
I created a new ASP.Net MVC application and published it to c:\inetpub\wwwroot\mvcApp.
I also created a dedicated pool (v4.0 Integrated) and configured it to run on port 8080.
The application works perfectly when I visit: http://server-host-name.company.com:8080.
Now, I created a virtual folder in the formsApp website in IIS and pointed it at mvcApp folder.
I also made sure that the pool used for the virtual folder is the Integrated pool, not the classic. The virtual folder name is mvc.
I could tell that IIS did something special to that folder, since its thumbnail icon is no longer a normal folder, but an application website thumbnail.
Now when I go to http://server-host-name.company.com/mvc I can see the page being loaded and the correct controller is called, the view is rendered, but the static script and CSS files are not loaded. When I examined the network log in the browser, I noticed that any request to the script or CSS static content is redirected to the Login Page, since the MVC app has Forms Authentication.
I have looked everywhere how to resolve this issue. Some answers pointed out that I should add a line in Web.config to add the line
<modules runAllManagedModulesForAllRequests="false" />
But that did not work. it had no effect, as the same page loaded without CSS or JS. But besides the fact that it worked or not, it does not explain why the app worked fine when IIS served it off of port 8080, without having that line included in Web.config.
Edit: Just to clarify, after the app runs from the virtual directory, the links/urls to the static files are valid with the name mvc prepended to them as expected.
How can I resolve this issue?
Related
After publishing a MVC5 web application of mine to my IIS server (Individual User Accounts), it would seem that the URL is accessed incorrectly.
During debug, it would be e.g http://localhost:1234/api/Account/UserInfo?=XXXXX
The debug works just fine. The only issue kicks in after I've published it via my IIS7 server.
After publishing and using Google Chrome's console, it would appear that the page is requesting for a resource at mydomainname.com/api/Account/UserInfo?=XXXX instead of mydomainname.com/WEBAPPLICATIONNAME/api/Account/UserInfo?=XXXX.
My best guess is to modify the URLs in /Scripts/app/app.datamodel.js but it would just cause more parsing problems.
I've searched around and can't seem to find any related problems. I hope someone here will be able to lend a hand.
Look like you are using relative path like "/api/Account/UserInfo". Instead i'll recommend you to use #Url.Content("/api/Account/UserInfo"). This will solve your problem
Explanation
In local system when we run application in WebDev server it never have sub folder (like WEBAPPLICATIONNAME) therefore you relative path work correctly. but when you host your application in IIS under Default website in another new website /Virtual folder (like 'WEBAPPLICATIONNAME') then "/api/Account/UserInfo" fall back to Default Website because for '/' in starting. #Url.Content or #Url.Action make sure to add virtual directory name, hence changing your path to "/WEBAPPLICATIONNAME/api/Account/UserInfo" in IIS.
VS2013 Update3, .Net 4.5, MVC, IIS 7
I created a new mvc project.
Tested from VS and it works.
From IIs, I created a folder in wwwroot, and made it an application. Add app pool with .net 4.0. Enabled windows authentication and disabled Anonymous authentication. Set service account in app pool and webapp.
From VS I deploy to IIS with default settings (which is NOT precompile) (using File System)
Site works fine on IIS.
But…
If deploy with the precompile setting clicked on. Web site fails with 403 error. Tried various combinations and get never get the precompiled to work. Always works when non-precompiled.
ASP.NET 4 was is registered in IIS.
Tried modules runAllManagedModulesForAllRequests="true" with no success.
I'm out of ideas and looking for help
Server Error in Application "xxx/MVCHELLOWORLD"
Internet Information Services 7.5
Error Summary
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Detailed Error Information
Module
DirectoryListingModule
Notification
ExecuteRequestHandler
Handler
StaticFile
Error Code
0x00000000
Requested URL
http://xxx/MvcHelloWorld/
Physical Path
C:\inetpub\wwwroot\MvcHelloWorld\
Logon Method
Negotiate
Most likely causes: •A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
Things you can try: •If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
• Enable directory browsing using IIS Manager. 1.Open IIS Manager.
2.In the Features view, double-click Directory Browsing.
3.On the Directory Browsing page, in the Actions pane, click Enable.
•Verify that the configuration/system.webServer/directoryBrowse#enabled attribute is set to true in the site or application configuration file.
Links and More InformationThis error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
View more information »
I just had the same issue and have been trying to resolve it for the last couple of days.
I have a Windows 8 pc running IIS 8 Express.
I copied an MVC site that was compiled and published from another pc, ran it, and got the same 403.14 forbidden as above. I then tried publishing the site uncompiled and running it and the site loaded just fine.
I then decided to load Visual Web Express on the Windows 8 pc and created a dummy MVC site and ran it compiled and uncompiled and it worked just fine. This showed me that IIS 8 Express was configured and working properly and there must be some issue in the way the site was compiling.
I tried different precompile methods during the publish including do not merge, merge all and merge each folder but none of those many any difference.
In the end I solved this by changing the Copy Local property to true for every Assembly referenced within the project. Even all the default ones that should be referenced from the GAC.
Not sure if I needed to copy every assembly to the bin folder or not but given the large number of assemblies referenced within my project this seemed easier then trying them 1 by 1.
EDIT: Made some changes and republished the site and now I'm back to the 403.14 forbidden again :(
I'm really pulling my hair out on this one as to why it isn't working.
I am deploying an MVC3 app to IIS6. If I navigate to the starting point of the application myserver/myapp it redirects to myserver/myapp/Account/LogOn?ReturnUrl= but it then show a 404 page not found error.
The views are in the correct folders. Security permissions are correct. If I deploy locally it works on my local iis7.5 perfectly. wildcard application maps have been set (isapi stuff). After creating a new default MVC3 app and deploying it to the iis6 website that works so there must be something different with the build? The build specifies any cpu. The application pool, the website and the virtual directory all specify .net4. We can't update iis and we can't change servers. Now, I'm out of ideas, any thoughts?
Thanks
Uncheck "Verify that file exists" on the Add/Edit Application Extension Mapping dialog window for your wildcard mapping.
need your help with this one, i'm running azure deployment on my localhost and get the webpage without css and javascript, when i look in fiddler i see 500 status and the following error: "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS" on each request for javascript or css file, i already enabled static content on windows feature and it didn't help, i'm using iis 7.5 on windows professional 64 bit with azure sdk 1.7, tried anything, and nothing helped, can't change the site to web application cause the website only exist on iis while i'm running debug, any idea what to do?
Could it be that the directory from which you're serving JS/CSS files contains a web.config file? If this is the case this will be causing the problem.
Your web.config contains an element which can only be defined in a real web application (in the root of your application for example- or in the machine.config. To fix this issue you'll need to open the machine.config (C:\Windows\Microsoft.Net\Framework\v4.0.30319\Config\machine.config) and look at each configSection defined here that is also included in your web.config (in the folder containing the JS/CSS files).
If the configSection in the machine.config contains the allowDefinition attribute with MachineToApplication as value this means you cannot use that configSection in a web.config that isn't located in a web application. Meaning in your case you'll need to remove that configSection from the web.config in the folder containing the JS/CSS files.
If you're using ASP.NET MVC this is probably your Content folder.
i have an asp.net mvc website. http:/mywebsite.com (just for this example)
I have been testing this asp.net mvc website locally on my machine and everything works fine on my local machine during testing. When i deploy to my web server
when i bring up http://mywebsite.com it goes to HomeController and load the view Views/Home/Index.aspx (which is perfect). So the main default page is fine.
The issue is, if i click any other other links (again that all seem to work fine locally) i get the following error:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
* Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
* If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
* Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
some examples would be:
http:/mywebsite.com\Photos
http:/mywebsite.com\Links
there definitely are controllers and views setup for this (or it wouldn't work locally).
does anyone have any idea how this might work fine locally but somehow on the webserver it doesn't
Are you running the site on II7 in integrated mode? If not, you need to add a wildcard handler so that all URLs get mapped to your application. See Phil Haack's blog post on running ASP.NET MVC ON IIS 6.
Something else to watch out for. I had a static website - deployed on IIS 7.5. Added some MVC Controllers to handle some simple server side apps and then re-deployed it. I didn't copy the web.config file, because I wrongly assumed that everything that was needed was in the one that was automatically created by the server.
You must copy the web.config up as well.