简体   繁体   English

WCF自托管服务的设计方法

[英]WCF Design Approach For Self-Hosted Service

I'm looking to have a WCF service that is self-hosted (No IIS!) Because I want to handle the data directly between to projects and not use a DB. 我希望拥有一个自托管的WCF服务(没有IIS!),因为我想直接在项目之间处理数据,而不要使用数据库。

Basicly what i need is a service that is listening to lets say: 基本上我需要的是正在听的服务,可以说:

http:/My-Public-IP/ServiceName/MethodName/ http:/ My-Public-IP / ServiceName / MethodName /

and when a user creates and HTTP Request to that address something happens, I want to be able to catch in debug mode so lets say I have an Operation Contract Called Ping: 当用户创建并向该地址发送HTTP请求时,我希望能够以调试模式捕获,因此可以说我有一个称为Ping的操作合同:

public string Ping()
{
 return "Ping";
}

when the user creates an HTTP REQUEST he will get to that method and so on... 当用户创建HTTP REQUEST时,他将进入该方法,依此类推...

My Question is what it the best design to do that, please keep in mind that this service is supposed to be accessible from all over the world, and is located on my Desktop, I know I need to open ports and stuff, but that I can Handle. 我的问题是这样做的最佳设计,请记住,应该可以从世界各地访问此服务,并且该服务位于我的桌面上,我知道我需要打开端口和东西,但是我可以处理。

I need from you guys suggestions on how to design such A project and if you have tutorials, example,articles or any data on the subject I'll be more than thankful. 我需要你们关于如何设计这样的A项目的建议,如果您有关于该主题的教程,示例,文章或任何数据,我将不胜感激。

thanks in advance. 提前致谢。

Whatever process you're using will need to create instances of the ServiceHost class. 无论您使用什么进程,都需要创建ServiceHost类的实例。 That's the core class that actually take care of recieveing, dispatching messages, instantiation of service instantes, etc. 那是核心类,实际上负责接收,调度消息,实例化服务实例等。

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

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