簡體   English   中英

Azure WCF服務使用Azure WCF服務

[英]Azure WCF Service Consume Azure WCF Service

我目前有一個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?)

我將WP7應用程序移動到它自己的解決方案中,然后當該應用程序在本地DevFabric中運行時,它能夠檢測到Web服務。 當WP7應用程序處於同一解決方案時,它無法找到它。

您是否查看過MSDN代碼庫中的WCF Azure Samples 已知問題 元數據有一個微妙之處,需要進行行為調整。 希望這會有所幫助。

在我在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>

如果該端口未運行,則不能使用該端口的引用,也不會找到元數據。

我會說你的服務器項目移動到IIS而不是Casini,因為它是在Azure平台上運行的地方。 我確實在Azure和Casini上遇到了一些在IIS上沒有發生的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM