【发布时间】:2017-02-15 12:59:56
【问题描述】:
我又遇到麻烦了。请对我温柔一点,因为我还不是专家。
在 Visual Studio 中,我制作了一个按预期工作的 web api。 要将项目移动到生产服务器,我将项目发布到文件系统(我个人计算机上的本地文件夹)。 现在我将这些文件移动到服务器(c:\inetpub\wwwroot\mydomain)
然后我已经编辑了主机文件
127.0.0.1 mydomain.com
127.0.0.1 www.mydomain.com
在 IIS 中,我创建了一个新网站:
Bindings:
Type = Http
IP address = All unassigned
Port = 80
Hostname = www.mydomain.com
Application pool:
Name= mydomain.com
.Net CLR version = .Net CLR version v4.0.30319
Managed pipeline mode = integrated.
当我 ping(IIS 服务器上的命令提示符)时,我得到了答案:
C:\Windows\System32>ping www.mydomain.com
Pinging www.mydomain.com [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
当我尝试浏览时,我收到以下错误消息: 此页面无法显示
此主机名 ( www.mydomain.com ) 的主机名解析(DNS 查找)失败。 Internet 地址可能拼写错误或过时,主机 ( www.mydomain.com ) 可能暂时不可用,或者 DNS 服务器可能没有响应。
请检查输入的 Internet 地址的拼写。如果正确,请稍后尝试此请求。
如果您有任何疑问,或者这种情况仍然存在,请联系您组织的网络管理员并提供如下所示的代码。
我在文件夹中有一个 SamplePage.aspx 页面:
<%@ Page Language="C#" CodeFile="SamplePage.aspx.cs"
Inherits="SamplePage" AutoEventWireup="true" %>
<html>
<head runat="server" >
<title>Code-Behind Page Model</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label id="Label1"
runat="server" Text="Label" >
</asp:Label>
<br />
<asp:Button id="Button1"
runat="server"
onclick="Button1_Click"
Text="Button" >
</asp:Button>
</div>
</form>
</body>
</html>
当我调用它时(使用 IIS IP,它会处理 SamplePage.aspx http://xx.xx.xx.xx/mydomain/SamplePage.aspx
更新: 我读过这个页面 https://forums.iis.net/t/1026696.aspx?IIS7+localhost+Page+Cannot+be+Found 问题是,如果我停止“默认网站”,那么我将无法再处理 http://xx.xx.xx.xx/mydomain/SamplePage.aspx
更新 2: 我刚刚在本地计算机上的 IIS 上尝试了相同的过程,结果完全相同通知代码:(1,DNS_FAIL,www.mydomain.com) 我一定做错了什么。但它可能是什么?
【问题讨论】:
-
您的浏览器是否尝试访问 https 而不是 http?
-
@kettch 不只是 http
-
还要验证没有 https 重定向。您也可以尝试将站点显式绑定到 127.0.0.1 而不是所有 IP。看来我已经读到该地址通常无效。
-
@kettch 127.0.0.1 给出了相同的结果。你能判断我的程序是否符合预期吗?
-
你正在做的是一个正常的过程,请检查这个url的状态www.mydomain.com/mydomain/SamplePage.aspx
标签: .net visual-studio dns iis-7 hosts