简体   繁体   中英

iis hosted web site differs from local web site

My local MVC ASP.NET project comes fully loaded and I can properly interact with it's controllers and API's

在此处输入图片说明

However, when I run the web site in IIS I get the following result, a horizontal blue bar across the screen

在此处输入图片说明

I am following this tutorial

Below are my settings for the site

在此处输入图片说明

When I click Test Settings, both authentication and authorization are green, and I have successfully added my user in Connect as...

My site bindings are below 在此处输入图片说明

I have changed my application pools to .NET v4.0 but that didn't fix anything, I am not sure if I should change them back or not.

Lastly, here is the list of enabled Windows Features.

在此处输入图片说明

Someone has registered the domain localhost.net - and the screenshot you show looks similar to what I get if I browse to that domain. I'm not sure why the tutorial would recommend that you use an existing domain to test against, even if you are "overriding" it by editing your hosts file.

The simplest fix would be to change the IIS binding to use a specific port (eg 9000), instead of the host header. Then you would access your site via an address like http://localhost:9000 or http://127.0.0.1:9000 but if you want to use the host header per the example, open the hosts file and check that your file has the exact entry in it per the tutorial. NB when editing the hosts file your editor needs to be running as Administrator or you won't be able to save the changes.

To test if your hosts file is correct, open a command prompt and ping webapi.localhost.net - if the IP address is not 127.0.0.1, your change is not taking effect.

Here is an example of binding to a port with no host header:

IIS屏幕快照,显示端口绑定

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM