开发者

Azure WCF Service Consume Azure WCF Service

I current have a solution with an Azure WCF service and a Windows Phone 7 project. I can run the development fabric locally and browse to the url (http://127.0.0.1:81/API/V1.svc) of my service fine. When I do Add Service Reference from the Windows Phone application it will discover the service fine, but when I try to view the methods on the service I get the error "Unable to launch the ASP.NET Development Server because port '50149' is in use." If I click OK I get "There was an error downloading metadata from the address. Please verify that you have entered a valid address."

I don't quite understand why it is discovering it on port 50149 since I browse to it on port 81 but I tried using port 81 when adding the service and I got

There was an error downloading 'http://localhost:81/API/V1.svc'. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:81 Metadata contains a reference that cannot be resolved: 'http://localhost:81/API/V1.svc'. There was no endpoint listening at http://localhost:81/API/V1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. Unable to connect to the remote server No connection could be made because the target machine actively refused it 127.0.0.1:81 If the service is defined in the current solution, try building the solution and adding the service reference again.

Here is my service model section

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

Do I need to defined and end point in here?

Does it have something to do with the WP7 project and the Azure WCF being in the same solution? (Do I have to have the WCF running when I trying to add service reference from the WP7 app?)


I moved the WP7 Application into its own solution and then it was able to detect the web service fine when that application was running in the local DevFabric. The WP7 application was just unable to find it when they were in the same solution.


Have you looked at the WCF Azure Samples known issues on the MSDN Code Gallery? There's a subtlety around metadata and a behavior tweak needed. Hopefully this helps.


In my WCF running in Azure I configure endpoints in two places (my example defines a secure ssl endpoint on port 443):

1st time in web.config to define endpoints contracts:

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

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

Afterwards, you also must make sure that Azure exposes your service thru its own endpoints in ServiceDefinition.csdef:

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


You cannot use a reference to that port if it is not running, no metadata will be found.

I would say move your server project to IIS instead of Casini since that's where it'll run while on the Azure platform. I did have some issues playing with Azure and Casini that did not happen on IIS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜