将服务托管为 WCF 服务
我有两个 .cs 文件,在一个文件中我将指定接口,在另一个文件中我将实现接口。现在我想将服务作为 WCF 服务托管在 IIS 上。 另一种方式是如何将现有的服务(功能)托管为 WCF 服务。 提前致谢。
I have two .cs files in one i will specify the Interfaces, and in another file i will implement the interfaces. Now i want to host Service as a WCF Service on IIS.
In another way How to host the already existing service(Functionality) as a WCF Service.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有多种选择:
将两个 *.cs 文件放入网站中的
App_Code
目录中,然后让 ASP.NET 根据需要进行编译。您将需要创建一个类似如下的服务文件:YourService.svc
将两个 *.cs 文件放入一个单独的类库项目中,并将它们编译成一个 DLL,然后将其放入网站/Web 应用程序中的
\bin
目录。您将需要创建一个类似如下的服务文件:YourService.svc
该服务文件告诉 IIS 运行时如何处理
http://(yourserver)/(virtualdirectory) 的传入请求/YourService.svc
URL。现在,一切设置完毕后,您应该能够使用 WCF 测试客户端发送 SOAP 请求(并接收返回响应)
You have several options:
put your two *.cs files into your
App_Code
directory in a web site and let ASP.NET compile then as needed. You will need to create a service file something like this:YourService.svc
put your two *.cs files into a separate class-library project and compile them into a DLL which you put into the
\bin
directory in your web site/web application. You will need to create a service file something like this:YourService.svc
This service file tells the IIS runtime how to handle incoming requests for the
http://(yourserver)/(virtualdirectory)/YourService.svc
URL.Now, once everything is setup, you should be able to connect to your service at the service URL using a tool like the WCF Test Client to send SOAP requests (and receive back responses)