再次遇到麻煩。請溫和我,因爲我不是專家 - 是。在IIS服務器上部署Visual Studio Web API
在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.
當我平安(Commandprompt 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服務器可能無響應。
請檢查輸入的互聯網地址的拼寫。如果正確,請稍後再試。
如果您有任何疑問,或者此情況持續存在,請聯繫您所在組織的網絡管理員,並提供下面顯示的代碼。
我有一個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 而事實是,如果我停止「默認Web站點」,然後即時通訊不再能夠處理http://xx.xx.xx.xx/mydomain/SamplePage.aspx
更新2: 我剛纔想在IIS同樣的程序我的本地計算機上使用完全相同的結果通知碼:(1 DNS_FAIL,www.mydomain.com) 我必須做一些錯誤的。但它會是什麼?
你的瀏覽器試圖打http?s **而不是http? – kettch
@kettch不僅http –
還確認沒有https重定向。您也可以嘗試將網站明確綁定到127.0.0.1而不是所有IP。好像我讀過那個地址通常不是有效的。 – kettch