简体   繁体   English

为WCF库创建接口

[英]Create Interface for WCF Library

I have recently started working with WCF design, to send messages securely from a web page to an application. 我最近开始使用WCF设计,以将消息从网页安全地发送到应用程序。

So far, I have successfully created a WCF Library that runs, and a web page the currently links to the service, sends a message, and receives the reply. 到目前为止,我已经成功创建了一个运行的WCF库,并创建了一个当前链接到该服务的网页,发送消息并接收答复。

Unfortunately, due to my very new approach to it, and somewhat outdated tutorials I have read, I don't know correctly how to (or don't know the correct way) to add a server side interface to this Library (if possible) so I can see some output on what the server is doing. 不幸的是,由于我采用了非常新的方法,并且阅读了一些过时的教程,所以我不正确地知道如何(或不知道正确的方式)向该库添加服务器端接口(如果可能)。这样我就可以看到服务器正在执行的一些输出。

Could anyone show me how to correctly add an interface to allow me to see? 谁能告诉我如何正确添加一个界面让我看到?

In ObfuscationService ObfuscationService

public class ObfuscationService : IObfuscation
    {
        public string Message(string msg)
        {
            return "Your message is: " + msg;
        }
    }

On the web app: 在网络应用上:

private void ServerService()
    {
        ObfuscationClient obfuClient = new ObfuscationClient();
        Response.Write(obfuClient.Message(@txtInput.Text));
    }

All I am doing for now is sending a message and returning it. 我现在所做的只是发送一条消息并返回它。

I need to elaborate methods on the string though, and I need UI on the server so I can print the process on the screen, show how many users are connected etc. 我需要在字符串上详细说明方法,并且我需要服务器上的UI,以便可以在屏幕上打印过程,显示已连接的用户数等。

As per the comments 根据评论

See this link: 看到这个链接:

wcftestclient fails, but only on remote machine wcftestclient失败,但仅在远程计算机上

You might need to write complete IP address 您可能需要输入完整的IP地址

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

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