English 中文(简体)
WCF REST 视窗电话通信
原标题:WCF REST communication with Windows Phone

我感到有些麻烦的是,我通过SalSharp通过我的视窗电话传给我自己主办的WCF服务。 请求书在提出方进行罚款,而请求结果又回到了,但当我试图对我关于其失败的实际装置的估价书进行答复时,请求并未归还任何东西。

Having done a fair amount of research I have discovered that apparently webHttpBinding is not supported on Windows Phone and therefore I need to add a basicHttpBinding endpoint to my Web.config file. However, when I try to do this I get several errors associated with having more than one endpoint and I can t seem to get any solution to successfully work with both of these. Switching the endpoint to basicHttpBinding and commenting out webHttpBinding also causes an error when I navigate to localhost:81/mywebservice.svc

   "System.InvalidOperationException: For request in operation analyseFace to be a stream the operation must have a single parameter whose type is Stream." 

2. 要求附有请求的上游。 它显示使用原始代码和同一地址的正常求助页面。

www.un.org/spanish/ecosoc 我的网页。

     <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        <behavior name="servicebehavior">
          <!--<serviceMetadata httpGetEnabled="true"/>-->
          <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="restbehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="servicebehavior" name="VizageAPIWebRole.vizage">
          <endpoint address="" behaviorConfiguration="restbehavior" binding="webHttpBinding" name="RESTEndPoint" contract="VizageAPIWebRole.Ivizage" />
          <!--<endpoint address="" binding="basicHttpBinding" contract="VizageAPIWebRole.Ivizage" />-->
        </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <bindings>
      <webHttpBinding>
        <binding name="RestBinding">
          <readerQuotas maxStringContentLength="5242880" maxArrayLength="16384" maxBytesPerRead="4096" />
          <security mode="None">
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

My WCF SERVICE

[ServiceContract]
public interface Ivizage
{
    [WebInvoke(UriTemplate = "/agerecog/{auth}", Method = "POST")]
    VizageResult analyseFace(string auth, Stream dataStream);

}

我很想知道,有人是否能够帮助我确定我不得不在我的网站上编辑的哪部法典。

最佳回答

Your code seems to be a REST service, but basicHttpBinding supports SOAP. So please continue to use webHttpBinding. However, on the Windows Phone side, the WCF cannot be used, it is needed to use WebClient or HttpWebRequest to access a REST service. WCF can just help us to access a SOAP service.

In addition, you mentioned the application works fine in the emulator, so it is unlikely to be a coding issue. It would be better if you can check whether your real phone device is able to access internet. Please also make sure you re using the cloud service s address instead of 127.0.0.1. Local address will not work on a real device.

Best Regards,

Ming Xu.

问题回答

From the exception and your config - you are using simplified configuration which by default uses basicHttpBinding. You have to explicity define service end point

 <services>
      <service  name="WcfRest.Ivizage">
        <endpoint behaviorConfiguration="restbehavior" binding="webHttpBinding"
         contract="WcfRest.Ivizage" />
      </service>
 </services>

Edit: 看像网 Http is not





相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签