WCF URI仅适用于localhost

pas*_*ena 0 c# wcf

创建服务主机后,当我使用Internet Explorer时,我无法打开"http:// myuri:8000/ServiceModelSamples/Service"页面.

  Uri baseAddress = new Uri("http://myuri:8000/ServiceModelSamples/Service");

  // Step 2 of the hosting procedure: Create ServiceHost
  ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
  // rest of the below code is from calculator MSDN sample
Run Code Online (Sandbox Code Playgroud)

它只有在我使用localhost而不是"myuri"时才有效.有人可以告诉你还需要什么吗?

编辑:myri实际上是我的PC名称.我也尝试在我的电脑上使用IP地址.Internet Explorer可以从我的框中打开URL,但是当我从其他框打开URL时它会失败(例如,我试图打开的URL是http://111.251.164.20:8000/ServiceModelSamples/Service)

Jon*_*Jon 5

呃...... myuri只是一个例子,一个占位符.不是你应该用字面意思的东西.