.NET WCF服务引用使用的服务器名称,而不是IP地址造成的问题时,消耗 [英] .NET WCF service references use server name rather than IP address causing issues when consuming

查看:283
本文介绍了.NET WCF服务引用使用的服务器名称,而不是IP地址造成的问题时,消耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我是一个新手,WCF ...

So, I'm a newbie to WCF...

我创建了消耗的ServiceLibrary我ServiceLibrary和网站项目。我能够通过创建从 WSDL 代理类来访问服务这是使用svcutil.exe的生成,然后用这个类来访问的方法在我的服务。所有这一切都被罚款我的本地机器。

I created my ServiceLibrary and web-site project that consumed the ServiceLibrary. I am able to access the service by creating a proxy class from the WSDL that was generated using svcutil.exe and then used this class to access the methods in my service. All of this was fine on my local machine.

然后我感动的服务,我的测试开发服务器(而不是域,所以我通过IP地址访问),并加入该网站的 IIS 。我能够获得通过//ip/ServiceSite/Service.svc服务,并通过//ip/ServiceSite/Service.svc?wsdl的WSDL。

I then moved the service to my test development server (not on the domain, so I am accessing via an IP address) and added the site to IIS. I was able to access the service via //ip/ServiceSite/Service.svc and the WSDL via //ip/ServiceSite/Service.svc?wsdl.

然而,试图消耗这项服务的时候我收到有关引用是不正确的错误。当我看//ip/ServiceSite/Service.svc所提供生成代理类的链接包含在地址的服务器的机器名,当我看到WSDL中引用的模式也包含机器名称 在URL中。本机名称不能被通过网络访问,因为它是不是在域。

However, when trying to consume this service I received an error about references being incorrect. When I look at the //ip/ServiceSite/Service.svc the link that is provided to generate the proxy class contains the machine name of the server in the address and when I look at the WSDL the references to the schemas also contain the machine name in the URL. This machine name cannot be accessed over the network as it is not on the domain.

有,而不是为服务器的机器名被放置在这些引用,它将使用的IP地址的方法吗?还是有什么其他的解决方案能够通过IP地址来访问服务?

Is there a way that instead of the machine name for the server being placed in those references that it would use the IP address? Or are there any other solutions to be able to access the service by IP address?

推荐答案

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

befor关闭system.serviceModel标签。它应该结束这样的:

befor closing the system.serviceModel tag. It should end like this:

<system.serviceModel > 
       .
       .
       .
   <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel >

这篇关于.NET WCF服务引用使用的服务器名称,而不是IP地址造成的问题时,消耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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