創建服務主機後,我無法在使用Internet Explorer時打開「http:// myuri:8000/ServiceModelSamples/Service」頁面。WCF URI只能在本地主機上工作
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
它只適用於我使用localhost而不是「myuri」。有人可以告訴還需要什麼嗎?
編輯:myri實際上是我的電腦名稱。我也嘗試使用IP地址爲我的電腦。 Internet Explorer能夠從我的盒子打開URL,但是當我打開其他盒子的URL(例如,我試圖打開的URL是http://111.251.164.20:8000/ServiceModelSamples/Service)時,它失敗了。
'myuri'是你真正的域名嗎? – 2011-03-22 20:38:51
myuri是pc名稱 – paseena 2011-03-22 21:22:26