如何从内部机器名称更改WSDL URL公众? [英] How to change WSDL URL from internal machine name to public?

查看:125
本文介绍了如何从内部机器名称更改WSDL URL公众?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有部署到Azure的一个简单的服务。它通过可访问:

I have a simple service that I deployed to Azure. It is accessible via:

http://xxxxxxxxxxxxxxxxxxxxxxx.cloudapp.net/MyTestService.svc

的URL WS​​DL使用内部机器名称,而不是一个公共DNS的:

The URL to the WSDL uses the internal machine name instead of a public DNS:

svcutil.exe http://rd001520d328923a/MyTestService.svc?wsdl

显然,WSDL是不从机器外部访问与此

Obviously, the WSDL is not accessible from outside the machine with this.

我知道,可如果你在IIS中运行这个改变了一些东西,或者如果你知道服务的URL。例如更改< serviceMetadata> 配置指定 httpGetUrl 属性,但是这是行不通的,因为我本来包括绝对URL。使用相对URL,它仍然使用内部机器名。真正的问题是,WSDL包括与机器名的URL引用,从而使之无用。

I am aware of a few things that can be changed if you are running this in IIS, or if you do know the url of the service. For example changing the <serviceMetadata> config to specify the httpGetUrl property, but this will not work as I would have to include the absolute URL. Using a relative URL, it still uses the internal machine name. The real issue is that the WSDL includes URL references with the machine name, therefore rendering it useless.

有两种解决方法不合:


  • 有人建议我可以抢WSDL,编辑它以固定的网址,然后上传它,所以它是从不同的URL访问。

  • It has been suggested that I could grab the WSDL, edit it to fix the URLs and then upload it so it is accessible from a different URL.

我发现从2010年年初的修补程序可用,但一定是一个更好的办法。

I found a hotfix from early 2010 was available, but there's got to be a better way.

这怎么能解决有代替机器名的面向公众的DNS?

How can this be solved to have the public facing DNS used instead of the machine name?

推荐答案

确定。我一直在寻找这将近一周。我终于找到了答案,因为它是不容易得到我希望这被索引并保存为他人的时间。

Ok. I have been looking at this for almost a week. I finally found the answer, since it is not easily available I hope this gets indexed and save the time for others.

基本上这个整体行为与WCF 3.0的已知问题/ 3.5,为此,他们发布的修补程序。你可以找到更多在这里: FIX:一个WCF WSDL文档中的URI是指无法进入内部实例而不是到负载平衡器...

Basically this overall behavior as a known issue with WCF 3.0/3.5, for which they released a hotfix. You can find out more here: FIX: URIs in a WCF WSDL document refer to inaccessible internal instances instead of to the load balancer...

我有我的研究过程中遇到了几次,但从来没有给它一个第二个想法,主要是因为我不知道我怎么会部署一个修补程序到Azure上。

I had come across this a few times during my research but never gave it a 2nd thought, mostly because I had no idea how I would deploy a hotfix into Azure.

幸运的是,在MSDN论坛微软主持人指出,这已被固定在.NET 4.0中。这是什么意思是,上面的知识库文章中建议的修复,仍然适用,唯独没有修补程序都必须适用。那么该如何解决?
很简单,以下内容添加到配置文件:

Fortunately, a Microsoft moderator at the MSDN forums pointed out that this had been fixed in .net 4.0. What this meant was that the "fix" recommended in the KB article above, still applied, with the exception that no hotfix had to be applied. So what is the solution? Simple, add the following to the config file:

<serviceBehaviors>
   <behavior name="<name>">
     <!-- Other options would go here -->
     <useRequestHeadersForMetadataAddress>
       <defaultPorts> <!-- Use your own port numbers -->
          <add scheme="http" port="81" />
          <add scheme="https" port="444" />
        </defaultPorts>
      </useRequestHeadersForMetadataAddress>
   </behavior>
</serviceBehaviors>

,就是这样。
这将是一个更简单的搜索,如果它已经更清楚,这个问题现在已经解决。也许我没有看够硬。

And that was it. This would have been a much simpler search if it had been clearer that this issue had now been fixed. Perhaps I didnt look hard enough.

这篇关于如何从内部机器名称更改WSDL URL公众?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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