如何在 Internet 上托管 wcf 服务? [英] How do I host a wcf service on the internet?

查看:27
本文介绍了如何在 Internet 上托管 wcf 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个基本的网络问题,但我是这个东西的新手,只是不知道答案.

This is probably a basic networking issue, but I am new to this stuff and just do not know the answer.

我已经编写了一个 wcf 服务和客户端.当我将机器的网络 IP 地址作为端点地址并从同一台机器运行客户端和服务器时,我可以使用 http 绑定之一并让服务正常工作.现在,我希望能够通过 Internet 从另一台机器连接到此服务.很明显,当我在这种情况下使用我的网络 IP 地址时它不起作用,但简单地输入我的路由器的宽带 IP 地址似乎也不起作用.是我错过了需要打开的防火墙端口,还是我正在尝试做一些不可能的事情?

I have written a wcf service and client. I can use one of the http bindings and get the service to work correctly when I put my machine's network IP address as the endpoint address and run the client and server from the same machine. Now, I want to be able to connect to this service from a different machine over the internet. Clearly it does not work when I use my network IP address in this scenario, but simply putting in my router's broadband IP address does not seem to be doing the trick, either. Am I just missing a firewall port that I need to open up, or am I trying to do something that should not be possible?

推荐答案

如果您希望来自 Internet 的用户能够连接到您的服务,您必须考虑以下几点:

If you want users from the internet to be able to connect to your service, you'll have to consider a few points:

  • binding:最小的公分母是 basicHttpBinding,它是 SOAP 1.1,基本上没有可用的附加功能 - 就像 ASMX 网络服务一样.几乎任何人都可以连接到它.对于更高级的客户端,您可能还希望在您的服务上公开一个 wsHttpBinding 端点

  • binding: the lowest common denominator is the basicHttpBinding which is SOAP 1.1 with basically no additional features available - just like ASMX webservices. Just about anyone can connect to that. For more advanced clients, you might also want to expose a wsHttpBinding endpoint on your service

安全性:您希望如何(如果有的话)保护对您的 Web 服务的访问?您是否有呼叫者必须提供的用户名/密码凭据?查看WCF 安全指南,了解有关各种安全场景的大量信息

security: how (if at all) do you want to secure access to your web service? Do you have username/password credentials that callers must supply? Check out the WCF Security Guidance for a whole slew of information bits on the various security scenarios

验证您的服务:通常,您应该努力让您的服务向世界其他地方验证自己 - 这需要服务器证书并启用在线安全通信(消息签名 + 加密)

authenticating your service: typically, you should strive to make your service authenticate itself to the rest of the world - this requires a server certificate and enables secured communication (messages signed + encrypted) on the wire

确保您的服务端点可以通过互联网、所有防火墙和代理以及一切访问:-)

make sure your service endpoint(s) is reachable from the internet, through all firewalls and proxies and everything :-)

希望能有所帮助!

这篇关于如何在 Internet 上托管 wcf 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆