Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF service accessed from silverlight
    primarykey
    data
    text
    <p>My application consist of an MVC3 website that contains a silverlight control. In the MVC3 application I host a WCF service. I use that service in the silverlight control to get data from the DB.</p> <p>In the MVC web.config the service is defined as:</p> <pre><code>&lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;endpointBehaviors&gt; &lt;behavior name="OnlineCustomersTracker.Services.CustomersTrackerServiceAspNetAjaxBehavior"&gt; &lt;enableWebScript /&gt; &lt;/behavior&gt; &lt;/endpointBehaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name=""&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt; &lt;services&gt; &lt;service name="OnlineCustomersTracker.Services.CustomersTrackerService"&gt; &lt;endpoint address="" behaviorConfiguration="OnlineCustomersTracker.Services.CustomersTrackerServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="OnlineCustomersTracker.Services.CustomersTrackerService" /&gt; &lt;/service&gt; &lt;/services&gt; </code></pre> <p></p> <p>The method that I call is:</p> <pre><code> [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Xml)] public string DoWork() { // Add your operation implementation here return "Work done"; } </code></pre> <p>In Silverlight I call the service:</p> <pre><code>CustomersTrackerServiceClient client = new CustomersTrackerServiceClient(new BasicHttpBinding(), new EndpointAddress( "http://localhost:62535/Services/CustomersTrackerService.svc")); client.DoWorkCompleted += new System.EventHandler&lt;DoWorkCompletedEventArgs&gt;(client_DoWorkCompleted); client.DoWorkAsync(); </code></pre> <p>When I access the service from silverlight I get the exception: The remote server returned an error: NotFound.</p> <p>The strange part is that the service is working from the web browser. Am I doing something wrong in silverlight?</p> <p><img src="https://i.stack.imgur.com/mF3lv.png" alt="application request"></p> <p>I traced the call from firefox and the silverlight control is doing a post to the service address: <a href="http://localhost:62535/Services/CustomersTrackerService.svc" rel="nofollow noreferrer">http://localhost:62535/Services/CustomersTrackerService.svc</a>. It seems that my service is listening only for get requests. Is there any way to allow post request ... or to configure the service in silverlight to make get requests?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload