0

我们正在尝试在 Amazon EC2 上托管一个 Silverlight 应用程序。

我可以让它提供 .xap 文件,但是我在使用 silverlight 应用程序所需的 web 服务时遇到了一些麻烦。

通常我会在 Visual Studio 中添加服务引用并输入 Web 服务的 URL,例如http://url.com/ServiceName.svc,然后会为我生成一个代理。

但是,随着 Amazon Elastic Cloud 实例输入 url

http://ec2-174-129-139-48.compute-1.amazonaws.com/AuthService.svc

给出错误“不被识别为已知的文档类型”

如果我进入

http://ec2-174-129-139-48.compute-1.amazonaws.com/AuthService.svc?wsdl

在 Internet Explorer 地址栏中,我得到一个 wsdl 描述 - 但它在配置中有这部分,这似乎有点奇怪

<wsdl:types>
<xsd:schema targetNamespace="http://asp.net/ApplicationServices/v200/Imports">
  <xsd:import schemaLocation="http://ip-0af8db15/AuthService.svc?xsd=xsd0" namespace="http://asp.net/ApplicationServices/v200" /> 
  <xsd:import schemaLocation="http://ip-0af8db15/AuthService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
  </xsd:schema>
  </wsdl:types>

schemaLocation http://ip-0af8db15/AuthService.svc?对我来说,这不是正确的地址吗?

任何人都知道我是否需要配置或更改某些内容以访问 Amazon EC2 上的 WCF Web 服务?

编辑:应注意:Windows Server 2003、IIS 6.0

编辑:看起来 ip-0af8db15 是机器名称

4

3 回答 3

1

以防万一有人遇到同样的问题:在代理生成时尝试删除 EC2 地址开头的 http://,然后在服务配置中将“ip-0af8db15”部分替换为 EC2 地址。

希望它有所帮助。

于 2010-12-07T18:10:05.583 回答
0

这个线程(特别是最后两个帖子)帮助我解决了这个问题。

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c7fd51a2-773e-41d4-95a0-244e925597fe/

于 2009-04-03T00:34:12.520 回答
0

我部署了相同的场景,没有任何问题。为什么不尝试使用 IP 地址而不是动态主机名:

http://174.129.139.48/AuthService.svc

编辑:

如果将无法访问的服务器名称放入 VS.Net 生成的代理中,则可以在自动生成的 configuration.svcinfo 中手动调整它。或者,您可以以编程方式设置 URL,这是一个更好的选择,因为如果您需要重新生成代理,它不会被覆盖。

BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://174.129.139.48/AuthService.svc");
YourProxy yourProxy = new YourProxy(binding, address);
于 2009-04-01T22:18:29.570 回答