views:

859

answers:

2

I'm trying to buid a site with the following:

  • VS 2010 (for the updated WCF RIA Services)
  • Silverlight 4.0 (packaged with WCF RIA Services).
  • MVC 2
  • EF 4.0

I am setting it up so that the public facing pages will be html from MVC, but the administration portion will be a silverlight navigation application using using WCF RIA Services for data access.

When I create the silverlight application within a webforms application, it works (I am able to add a datagrid and retrieve data using EF 4.0 and WCF RIA Services successfully): alt text

When I create the silverlight application within an MVC2 application: alt text

I get an error as follows (I've added the same datagrid in both cases - a simple table with 2 records): alt text

The webforms server-side works while the MVC server side doesn't. I've unsuccessfully tried WCF logging as well as fiddler, but I somehow can't get any output (using the example here: http://msdn.microsoft.com/en-us/library/ms730064.aspx), and I've also tried fiddler to get some information with no luck. I'm really struggling with this and I wonder if anyone else has run into this issue and found a way around it?

Thanks, Dennis

+4  A: 

Ignoring the routes for the services corrected this problem when added to Global.asax.cs:

routes.IgnoreRoute("{*allsvc}", new { allsvc = @".*\.svc(/.*)?" });

Credit for this answer has to go to OneSmartGuy: his answer fixed my issue also.

Dennis Ward
This solution stopped working with SL4 and the final release of WCF RIA Services.
Dennis Ward
A: 

This issue might be specific to my site, but perhaps other people are having the same issue, and I had been so darn frustrated by this that I had given up for a while and tried other methods to get done what I wanted, but came back to Silverlight because I have a hard time with Javascript and JS UI libraries. I had better luck with fiddler when working on the deployed site (I didn't get any output when working with the development server).

When I browsed to my site with the silverlight app, the dialog popped up with the usual "load operation failed for query...", and fiddler showed the following when highlighting the error:

IIS specified authentication schemes 'Basic, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.

I looked up this error in the DiscountASP.net (my hosting provider) and found a KB article that instructed me to update the web.config (for IIS7) as follows:

<system.webServer>
  <security>
    <authentication>
      <basicAuthentication enabled="false" />
    </authentication>
  </security>
</system.webServer>

And viola! I could use WCF RIA Services with Silverlight in asp.net MVC2! I found also that it was unnecessary for me to create a special service and a domainhostfactory as described in several blog posts while researching this stuff, or change the routing to avoid interactions with MVC and the service request. This is all I had to do

I guess this is a pretty basic fix, and hopefully it'll help someone else. I was extremely frustrated with this, and dissapointed that such a simple fix is publicly available, yet no step-by-step instructions for this scenario is given from Microsoft as this is using the most up-to-date microsoft technologies.

Thanks, Dennis

Dennis Ward