WCF(IIS中的托管服务) - WCF而不是IP自动获取机器名称? [英] WCF (hosting service in IIS) - machine name automattically being picked up by WCF rather than IP?

查看:196
本文介绍了WCF(IIS中的托管服务) - WCF而不是IP自动获取机器名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我之前发布了将我的本地计算机上的工作WCF服务移动到开发服务器的麻烦。问题在于,将其移动到所有引用时都是通过机器名而不是ip。由于我没有在域上访问它,我看不到机器名称,也无法访问引用。这是我以前的帖子( .NET WCF服务引用使用服务器名称而不是IP地址导致消费时出现问题

So, I previously posted about my troubles in moving a working WCF service from my local machine to the development server. The problem was that when moving it over all of the references were by machine name rather than ip. Since i was not accessing it on the domain, I couldn't see the machine name and couldn't access the references. Here was my previous post (.NET WCF service references use server name rather than IP address causing issues when consuming).

我找到了解决方案,但想确保这是我的问题的正确解决方案。并询问是否有其他人有任何其他意见?解决方案是更改IIS站点绑定。我找到了解决方案( http://blogs.msdn.com/wenlong/archive/2007/08/02/how-to-change-hostname-in-wsdl-of-an-iis-托管-service.aspx )。唯一的问题是我可能必须为每个站点执行此操作,因为我使用的应用程序不是托管的,并且是在每个站点上安装的基于Web的解决方案。因此,我可能必须在每个站点的构建中包含一个脚本。

I found a solution, but wanted to make sure that this is the proper solution to my issue. And also ask if anyone else had any other input? The solution was to change the IIS site binding. I found the solution at (http://blogs.msdn.com/wenlong/archive/2007/08/02/how-to-change-hostname-in-wsdl-of-an-iis-hosted-service.aspx). The only thing is that I may have to do this for every site as the application that i work with is not hosted and is a web-based solution installed at each site. So i'm possibly going to have to include a script in the build for each site.

我认为我可以在.config中进行此更改文件?

I would think that I would be able to make this change in the .config file?

推荐答案

处理此问题的正确方法是在IIS中为Web站点实例设置显式主机标头。现在,假设您只有一个应用于Web站点实例的主机头应该是您需要的全部内容。但是,如果您配置了多个主机头,则还需要明确告诉WCF哪个主机通过它自己公开。这是通过配置元素在元素下绑定服务完成的到那个特定的域名。

The right way to handle this is to set and explicit host-header in IIS for the Web Site instance. Now, assuming you've only got one host-header applied to the Web Site instance that should be all that you need. However, if you have multiple host-headers configured you will also need to explicitly tell WCF which host to expose itself via. This is done with the configuration element under the element to bind the service to that specific domain.

这篇关于WCF(IIS中的托管服务) - WCF而不是IP自动获取机器名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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