以下代码可以正常工作
Dim testRequest As System.Net.HttpWebRequest
Dim testResponse As System.Net.HttpWebResponse
Try
testRequest = System.Net.HttpWebRequest.Create(String.Format("{0}/checksomething.aspx", "http://168.108.220.108/"))
With testRequest
.Timeout = 30000
.Credentials = System.Net.CredentialCache.DefaultCredentials
End With
testResponse = testRequest.GetResponse()
Dim sr As New System.IO.StreamReader(testResponse.GetResponseStream)
Dim str As String = sr.ReadToEnd
Catch ex As WebException
Dim s = ex.InnerException
Finally
End Try
此消息返回错误消息(例如,InnerException返回目标主体名称不正确)
Dim testRequest As System.Net.HttpWebRequest
Dim testResponse As System.Net.HttpWebResponse
Try
testRequest = System.Net.HttpWebRequest.Create(String.Format("{0}/checksomething.aspx", "http://ServerName.domainName.something.something"))
With testRequest
.Timeout = 30000
.Credentials = System.Net.CredentialCache.DefaultCredentials
End With
testResponse = testRequest.GetResponse()
Dim sr As New System.IO.StreamReader(testResponse.GetResponseStream)
Dim str As String = sr.ReadToEnd
Catch ex As WebException
Dim s = ex.InnerException
Finally
End Try
所以2之间的唯一区别是链接 “ http://168.108.220.108/” “ http://ServerName.domainName.something.something”
我可以通过Internet Explorer访问此链接:http://ServerName.domainName.something.something
是否需要在IIS上进行更正?