Wcf服务仅适用于localhost [英] Wcf service only works localhost

查看:118
本文介绍了Wcf服务仅适用于localhost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个简单的WCF服务和一个使用该服务的应用程序。 Visual Studio和IIS都在相同的(开发人员)机器上。



- 应用程序已编译并正常工作

-应用程序随后发布后,浏览器会自动显示URL

http://MyServerName/Math/publish.htm。应用程序正常工作



但是当我尝试使用远程客户端时,b
$ b,应用程序错误 http:// localhost:49380 / ServiceName.svc没有终点监听



为什么要尝试使用localhost:49380 URL(默认为VS )?



Visual Studio包含配置的app.config,它指定端点,如下所示:

端点地址=http:/ /localhost:49380/MathService.svcbinding =basicHttpBinding

.....

试图在这里编辑端点但是后来连本地浏览器都不能工作。

有什么想法吗?



我尝试了什么:



我尝试使用在本地工作的URL修改app.conf

我也尝试使用和不使用端口指定相同的URL



http:// MyServerName:port / Math / publish.htm

I have developed a simple WCF service and an application to consume the service. Both Visual Studio and IIS are on the same (developers) machine.

-Application is compiled and works fine
-The application is then published and browser automatically displays the URL
http://MyServerName/Math/publish.htm. Application works fine

BUT

when I tried to use a remote client, the application errors with "there was no end point listening at http://localhost:49380/ServiceName.svc"

Why is it trying to use the localhost:49380 URL (default by VS)?

Visual Studio contains the app.config which is configured that specifies the endpoint like this:
endpoint address="http://localhost:49380/MathService.svc" binding="basicHttpBinding"
.....
Tried to edit the endpoint here but then not even the local browser would work.
Any ideas?

What I have tried:

I tried to modify the app.conf with the URL that works in localiy
I also try to specified the same URL with and without port

http://MyServerName:port/Math/publish.htm

推荐答案

基本上,我因为您的客户端没有尝试引用实际服务 - 它仍在尝试访问本地版本。您需要确保您的客户端使用正确的远程地址,并且那里没有硬编码连接。

看看这个:如何获得在Web托管服务上工作的基本WCF服务 [ ^ ] - 它对我有用!
Basically, it's because your client isn't trying to reference the actual service - it's still trying to access the local version. You need to make sure that your client is using the right remote address and that there are no "hard coded" connections there.
Have a look at this: How to get a basic WCF service working on a web hosting service[^] - it worked for me!


这篇关于Wcf服务仅适用于localhost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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