简体   繁体   English

将WCF Web服务部署到IIS

[英]Deploying WCF webservice to IIS

I'm trying to deploy a wcf web service to IIS 7.5. 我正在尝试将wcf Web服务部署到IIS 7.5。 Is there anything special I need to do in order to make this work. 为了使这项工作有什么特别的我需要做。 I keep getting 404 error when I try and run the web service. 尝试运行Web服务时,我不断收到404错误。 I can't seem to pull up the wsdl file either. 我似乎也无法拉起wsdl文件。

These are the steps I've taken 这些是我采取的步骤

  1. Right-clicked on web service project and published to local folder 右键单击Web服务项目并发布到本地文件夹
  2. Copied contents of publish to IIS server 复制的内容发布到IIS服务器
  3. Setup a new website that points to folder with webservice files 设置一个新网站,指向带有Web服务文件的文件夹
  4. set binding to match web.config binding (port #) 设置绑定以匹配web.config绑定(端口号)

Is there anything I missed or overlooked. 有什么我想念或忽略的。 Shouldn't I be able to run that web service from IIS and load up the wsdl file directly on the server. 我不应该能够从IIS运行该Web服务并直接在服务器上加载wsdl文件。 When I test in visual studio, it handles the loading of that host program. 当我在Visual Studio中测试时,它会处理该主机程序的加载。

显然,您必须加载我没有执行的.svc文件路径。

Just to expand on this a little, since this question got me started but there were a couple of extra steps I had to take: 为了进一步说明这一点,自从这个问题使我开始学习以来,但是我还必须采取一些额外的步骤:

  1. In VS2012 right click on the web service project and select Publish 在VS2012中,右键单击Web服务项目,然后选择“发布”。
  2. Publish to file system by selecting a directory to publish to 通过选择要发布到的目录来发布到文件系统
  3. Copy the folder contents into a folder on the server 将文件夹内容复制到服务器上的文件夹中
  4. In IIS create a new website, its physical path being where you just copied the published contents to. 在IIS中创建一个新网站,其物理路径是您刚刚将发布的内容复制到的位置。
  5. Set its app pool appropriately (probably .NET 4.0) 适当设置其应用程序池(可能是.NET 4.0)
  6. The binding port should be the same as in the web.config as should the name. 绑定端口应与web.config中的名称相同。 So if you've been working locally and your web.config reads "http://localhost:12345/MyService" then hostname is "localhost" and the port is 12345 因此,如果您一直在本地工作,并且您的web.config读取"http://localhost:12345/MyService"则主机名是“ localhost”,端口是12345

You can then browse to the webservice by right clicking on the website in IIS -> Manage Website -> Browse. 然后,您可以通过右键单击IIS中的网站->管理网站->浏览来浏览到Web服务。 Click on your service name. 单击您的服务名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM