iis托管的网站与本地网站不同 [英] iis hosted web site differs from local web site

查看:101
本文介绍了iis托管的网站与本地网站不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​地MVC ASP.NET项目已完全加载,我可以与它的控制器和API正确交互

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

但是,当我在IIS中运行网站时,会得到以下结果,屏幕上出现一个水平的蓝色条形图

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

我正在关注本教程

以下是我对该网站的设置

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

我已将应用程序池更改为.NET v4.0,但这并不能解决任何问题,我不确定是否应将其改回.

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.

最后,这是已启用的Windows功能的列表.

Lastly, here is the list of enabled Windows Features.

推荐答案

某人已注册域localhost.net-并且显示的屏幕截图与浏览该域时所获得的屏幕快照相似.我不确定为什么本教程会建议您使用现有域进行测试,即使您通过编辑主机文件来覆盖"该域也是如此.

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.

最简单的解决方法是将IIS绑定更改为使用特定端口(例如9000)而不是主机标头.然后,您可以通过 http://localhost:9000

The simplest fix would be to change the IIS binding to use a specific port (e.g. 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.

要测试您的主机文件是否正确,请打开命令提示符,并 ping webapi.localhost.net -如果IP地址不是127.0.0.1,则您的更改没有生效.

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托管的网站与本地网站不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆