Azure WCF服务使用Azure WCF服务

时间:2010-11-21 22:16:18

标签: wcf windows-phone-7 azure

我目前有一个Azure WCF服务和Windows Phone 7项目的解决方案。我可以在本地运行开发结构并浏览到我的服务的URL(http://127.0.0.1:81/API/V1.svc)。当我从Windows Phone应用程序添加服务引用时,它会发现服务正常,但是当我尝试查看服务上的方法时,我收到错误“无法启动ASP.NET Development Server,因为端口'50149'在使用。”如果我单击“确定”,则会显示“从地址下载元数据时出错。请确认您已输入有效地址。”

我不太明白为什么它会在端口50149上发现它,因为我在端口81上浏览它但是在添加服务时我尝试使用端口81而且我得到了

下载'http:// localhost:81 / API / V1.svc'时出错。 无法连接到远程服务器 无法建立连接,因为目标计算机主动拒绝它127.0.0.1:81 元数据包含无法解析的引用:'http:// localhost:81 / API / V1.svc'。 在http://localhost:81/API/V1.svc没有可以接受该消息的端点监听。这通常是由错误的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。 无法连接到远程服务器 无法建立连接,因为目标计算机主动拒绝它127.0.0.1:81 如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。

这是我的服务模型部分

<system.serviceModel>
   <services>
     <service name="DocDemon.API.V1">
       <endpoint name="basicHttpBinding" binding="basicHttpBinding" contract="DocDemon.API.IV1" />
     </service>
   </services>
  <behaviors>
   <serviceBehaviors>
    <behavior name="">
     <serviceMetadata httpGetEnabled="true"  />
     <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
   <bindings>

   </bindings>
 </system.serviceModel>

我需要在这里定义和终点吗?

是否与WP7项目和Azure WCF处于同一解决方案有关? (当我尝试从WP7应用程序添加服务引用时,是否必须运行WCF?)

4 个答案:

答案 0 :(得分:1)

我将WP7应用程序移动到它自己的解决方案中,然后当该应用程序在本地DevFabric中运行时,它能够检测到Web服务。当WP7应用程序处于同一解决方案时,它无法找到它。

答案 1 :(得分:0)

您是否查看了MSDN代码库中的WCF Azure示例known issues?元数据有一个微妙之处,需要进行行为调整。希望这会有所帮助。

答案 2 :(得分:0)

在我在Azure中运行的WCF中,我在两个地方配置端点(我的示例在端口443上定义了一个安全的ssl端点):

第一次在web.config中定义端点合同:

<system.serviceModel>
    <services>
        <service
            behaviorConfiguration="CustomValidationBehavior"
            name="ServiceName">

            <endpoint 
                                binding="wsHttpBinding"
                                bindingConfiguration="MembershipBinding"
                                name="bindingName                                   contract="InterfaceName" />

之后,您还必须确保Azure通过ServiceDefinition.csdef中自己的端点公开您的服务:

<InputEndpoints>
  <InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="CertName" />
</InputEndpoints>

答案 3 :(得分:0)

如果该端口未运行,则无法使用该端口的引用,也不会找到元数据。

我会说你的服务器项目移动到IIS而不是Casini,因为它是在Azure平台上运行的地方。 我确实在Azure和Casini上遇到了一些在IIS上没有发生的问题。

相关问题