2011-01-20 38 views
0

我有一个WCF服务托管在Azure的卷轴中。WCF在Azure中无法访问

当我在开发结构中测试它时,它可以从我的网页(其他网络角色)正常工作。

但是,当我将它部署到云中时,它似乎并未运行,尽管webrole已准备就绪。

当我使用Fiddler做我的WCF服务的公共方法中的一种东西,我得到:

[提琴手]连接到 xxxxxxxxxxxxxx.cloudapp.net失败。 异常文本:连接尝试 失败,因为连接的方没有 一段 时间后没有正确响应或已建立的连接失败 ,因为连接的主机没有 响应yyyyyyyyyyyyyy

这是服务配置:

<?xml version="1.0" encoding="utf-8"?> 
<ServiceDefinition name="GovGuard" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> 
    <WebRole name="GovGuard.Services"> 
    <Sites> 
     <Site name="Web"> 
     <Bindings> 
      <Binding name="GuardServiceEndpointBinding" endpointName="GuardServiceEndpoint" /> 
     </Bindings> 
     </Site> 
    </Sites> 
    <ConfigurationSettings> 
     <Setting name="DevelopmentConnectionString" /> 
     <Setting name="GovGuardStorageConnectionString" /> 
    </ConfigurationSettings> 
    <Endpoints> 
     <InputEndpoint name="GuardServiceEndpoint" protocol="http" port="81" /> 
    </Endpoints> 
    <Imports> 
     <Import moduleName="Diagnostics" /> 
    </Imports> 
    <LocalResources> 
     <LocalStorage name="MyCompany.GovGuard.Services.svclog" sizeInMB="1000" cleanOnRoleRecycle="false" /> 
    </LocalResources> 
    </WebRole> 
    <WebRole name="GovGuard.Web"> 
    <Sites> 
     <Site name="Web"> 
     <Bindings> 
      <Binding name="GuardWebEndpointBinding" endpointName="GuardWebEndpoint" /> 
     </Bindings> 
     </Site> 
    </Sites> 
    <ConfigurationSettings> 
     <Setting name="GuardServiceUrl" /> 
     <Setting name="DevelopmentConnectionString" /> 
     <Setting name="GovGuardStorageConnectionString" /> 
    </ConfigurationSettings> 
    <Endpoints> 
     <InputEndpoint name="GuardWebEndpoint" protocol="http" port="80" /> 
    </Endpoints> 
    <Imports> 
     <Import moduleName="Diagnostics" /> 
    </Imports> 
    <LocalResources> 
     <LocalStorage name="MyCompany.GovGuard.Web.svclog" cleanOnRoleRecycle="false" sizeInMB="1000" /> 
    </LocalResources> 
    </WebRole> 
</ServiceDefinition> 

(编辑) 在我的问题的调查,可能是这样的:我用的是Microsoft.SqlServer.Types装配在文件基准WCF项目。我使用copy-local = true将程序集复制到bin文件夹,并将其打包在.csx文件中。但是...... Microsoft.SqlServer.Types还需要SqlServerSpatial.dll库(不是程序集)。我创建了一个postbuild脚本来将该dll复制到bin中,但是我没有成功......

也许有人可以帮助我如何将.dll文件(不是程序集)打包到.csx文件中。 ..

(编辑) 这里找到它:http://msdn.microsoft.com/en-us/gg271395

+0

您可能需要共享一些代码......一个常见的错误是将端口设置为80以外的值。可能要检查ServiceDefinition.csdef。 – smarx 2011-01-20 19:24:50

回答

1

终于有效的解决方案:我在32位Win7机器上开发,并将SqlServerSpatial.dll从我的机器复制到WCF项目(复制到输出目录和BuildAction内容)。这在云中造成了一个奇怪的错误信息,因为那个库是32位的!我用64位版本更新了这个库,现在在云中部署完毕后,一切正常!

1

WCF没有发挥很好,如果你正在尝试做一个自我托管服务。

由于HTTP.sys注册发生的方式,它会在本地计算机名称上执行此操作,并且不允许您执行接受负载平衡名称的通配符注册。您拥有的选项是使用内部端点,并尝试从您的Web主机连接辅助角色的IP。

我最终做的只是将我的WCF服务转换为MVC端点,并将我的工作者角色转换为Web应用程序。这不是最优雅的,但它的工作。

+0

嗨亚伦。我的解决方案可行WCF不应该成为Azure中的问题,但要小心使用使用本地库的CLR库......在我的情况下,整个WCF服务没有运行,因为我没有将本地库作为Azure的一部分包! – 2011-01-24 14:48:18