Friday, February 1, 2013

What can cause Ria Services 404 error, specifically the requests have '/binary' in them

What can cause Ria Services 404 error, specifically the requests have '/binary' in them

This is currently in development, Visual Studio 2012, Silverlight 5, and Ria Services. I've heard of these issues with deployment but i've not got that far yet.

When I look at the call in Fiddler the url looks like this:

http://127.0.0.1:81/ClientBin/DanielHarris-SilverlightApp-RiaService-NameOfDomainServiceClass.svc/binary/GetColours 

This is returning a 404, however I don't believe the '/binary' should be in the URL, and that if it was requesting via that then the call would succeed.

To give a bit more information here is an overview of the layout of the solution:

Class Library Containing an EF Entity Model (ObjectContext) Silverlight Application ASP.NET Web Application with a DomainService class ASP.NET Web Application with the actual website that display the silverlight XAP 
  • The ASP.NET App with the DomainService references the EntityModel class library
  • The Silverlight Application has RIA Services Enabled, the RIA services link in the SL Apps properties is set to the ASP.NET App with the DomainService class in it
  • The ASP.NET Web App with the actual website that displays the Silverlight XAP runs up and loads the control fine at the right point, any RIA calls fail

I am wondering is it not supported to put the DomainService class in it's own .NET Web Application? My thinking was this would then create an endpoint for RIA completely separate to the 'Main' Web App that actually shows the Silverlight control.

Is that where I am going wrong?

EDIT - I have also tried moving the Entity Model from it's own Class Library into the Web App that has the DomainService class, I still get the same issue. Do the DomainService, Entity Model, and the site that displays the Silverlight app all need to be in the same project? I.E All under the one web app?

Answers & Comments...

Answer: 1

By default silverlight(ria svc) uses binary endpoint.

WCF compress xml and it will be binary. Otherwise it could be heavy.

When I trace it in fiddler I always see /binary expressions on domain service calls. I also use EF. So binary should be in url.I think it should be configuration error.

Here is my request

/ClientBin/AHBSBus-Web-DomainSrv-DSrvSecurity.svc/binary/getServerDate

//request

< getServerDate xmlns="http://tempuri.org/"> < /getServerDate>

//response

< getServerDateResponse xmlns="http://tempuri.org/"> < getServerDateResult> 2013-01-24T15:53:13.4574466+02:00 < /getServerDateResponse>

http://blogs.msdn.com/b/saurabh/archive/2009/11/23/understanding-the-wcf-in-wcf-ria-services.aspx

The RIA Services ServiceHost creates the following endpoints by default -

a) For Silverlight Client: SOAP w/binary endpoint. Address = "binary", Binding = CustomBinding consisting of HttpTransportBindingElement and BinaryMessageEncodingBindingElement ..

You may trace your bindings by logging details. Put these lines in your web.config run your project and open log file.

<system.diagnostics>  <trace autoflush="true">      <listeners>      </listeners>  </trace>  <sources>      <source name="System.ServiceModel"              switchValue="Information, ActivityTracing"              propagateActivity="true">          <listeners>              <add name="sdt"                   type="System.Diagnostics.XmlWriterTraceListener"                   initializeData= "WcfDetailTrace.svclog" />          </listeners>      </source>  </sources>  

by : Davut Gürbüzhttp://stackoverflow.com/users/413032

Answer: 2

By default the Silverlight application is going to try and find the DomainService at the Application that is hosting it. If you want to have the DomainService at a different URL then you need to pass that URL into the constructor of the DomainContext.

If you are using a separate class library you need to make sure that the web application either references the class library or has the dll for the class library in the bin directory. You also need the RIA Services dlls and web.config setup. The easiest way now to do the later is to add the RiaServices.Server NuGet package to both the class library and the web application. The new package references the correct dlls and sets up the web.config.

by : Colin Blairhttp://stackoverflow.com/users/1633696




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog