简体   繁体   English

C#Web服务部署到IIS服务器

[英]C# web service Deployment to IIS Server

I have created a web service using C# and I have installed IIS Server 6.0. 我已经使用C#创建了一个Web服务,并且已经安装了IIS Server 6.0。 When I am running web service directly in project its working well. 当我直接在项目中运行Web服务时,它运行良好。 Now I want to deploy this service on my system's IIS Server so that my LAN partners can use it. 现在,我想将此服务部署在系统的IIS服务器上,以便我的LAN合作伙伴可以使用它。 How should I do that? 我应该怎么做? And I want to change default port number of IIS too, how can I do that? 我也想更改IIS的默认端口号,该怎么办?

To run your web service under IIS , setting up a virtual directory is pretty straightforward . 要在IIS下运行Web服务,设置虚拟目录非常简单

If you're looking to test publish a build, the web deployment project is the best option, you can do it from the command line and in VS.Net, it enables a "Publish" right-click option. 如果要测试发布发布,则Web部署项目是最佳选择,您可以从命令行执行该操作,在VS.Net中,它启用"Publish" right-click选项。

Your web service endpoint is your .asmx file (no .cs file required in your deployment), and the DLL in the bin folder contains the code that you wrote for your webservice. 您的Web服务端点是.asmx文件(在部署中不需要.cs文件),bin文件夹中的DLL包含您为Web服务编写的代码。

SOAP, WSDL, Namespace are all handled by IIS and ASP.NET. SOAP, WSDL, Namespace均由IIS和ASP.NET处理。

In simple words: 简单来说:

  1. create a project of type "ASP.NET Web service" . 创建一个类型为"ASP.NET Web service"
  2. Select "HTTP" from location dropdownlist (indicates that the file should be placed on a web server) 从位置下拉列表中选择"HTTP" (表明该文件应放置在Web服务器上)
  3. After Develop your web service, Add web references, select "browse UDDI Servers on the local network" option if you want to share the web service among different computer. 开发Web服务后,添加Web引用,如果要在另一台计算机之间共享Web服务,请选择"browse UDDI Servers on the local network"选项。 Enter the source .asmx file URL and click "Go" . 输入源.asmx文件URL,然后单击"Go"
  4. Select "Add References" to add your reference name for web service, by default is "localhost" , you can give it a name. 选择"Add References"以添加Web服务的引用名称,默认情况下为"localhost" ,您可以为其命名。
  5. Declare a reference for your web service in your .aspx file. 在.aspx文件中声明Web服务的引用。
  6. You can try run your application in other PC. 您可以尝试在其他PC上运行您的应用程序。

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

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