如何发布我的WCF服务?

时间:2012-06-26 21:22:27

标签: wcf localhost nat

我想在互联网上使用我的网络服务。我打开了我的端口4501,我在调制解调器和Windows上禁用了防火墙。我可以写我的全局IP,我可以打开调制解调器控制接口。但我想连接到iis,地址是xx.xx.xx.xx:4501 / Products.svc

它适用于localhost(http:// localhost:4501 / Product.svc)但我无法连接到互联网上的svc ..

我不知道问题在哪里。

当我添加我的svc链接地址作为添加参考服务时,我收到此错误

  There was an error downloading 'http://xx.xx.xx.xx:4501/Products.svc'.
  Unable to connect to the remote server
  Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı xx.xx.xx.xx:4501
  Metadata contains a reference that cannot be resolved:                         'http://xx.xx.xx.xx:4501/Products.svc'.
  There was no endpoint listening at http://xx.xx.xx.xx:4501/Products.svc that could           accept the message. This is often caused by an incorrect address or SOAP action. See    InnerException, if present, for more details.
  Unable to connect to the remote server
  Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı xx.xx.xx.xx:4501
  If the service is defined in the current solution, try building the solution and      adding the service reference again.

还有一点,

如果我开始使用IIS,即使在localhost中,wcf服务也不起作用。如果我在Visual Studio中启动它(我的意思是asp.net开发服务工作)它可以工作..

IIS版本为7.5.7600,我将应用程序池添加为Asp.net 4.0

1 个答案:

答案 0 :(得分:0)

在IIS中使用端口4501 for HTTP有什么特别的原因吗?

Visual Studio 2010 WebDev WebServer(Cassini)使用随机端口号(在您的情况下为4501)来简化配置。它假设端口80可以被其兄弟IIS或任何其他软件占用。

这对于本地计算机的开发来说很好,但是不需要在生产中使用相同的端口。

默认HTTP端口为80,通常是网络中最开放的开放端口。

在IIS中使用端口80进行HTTP流量,您的生活将更加轻松。

P.S。你试过http://xx.xx.xx.xx/Products.svc了吗?端口号是Web服务配置的一部分,将应用程序移动到IIS时不会复制它。 IIS可能已使用默认HTTP端口。