Why Can't You Code?
The highest form of ignorance is when you reject something you don't know anything about.
The highest form of ignorance is when you reject something you don't know anything about.
These are the steps I had to go through to migrate a Silverlight application that was running on the .NET RIA Services preview released in July 09, to the new WCF RIA Services released during PDC 09:
<system.webServer>
...
<handlers>
...
<add name="DataService" verb="GET,POST" path="DataService.axd" type="System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
<httpHandlers> ... <add path="DataService.axd" verb="GET,POST" type="System.Web.Ria.DataServiceFactory, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /> </httpHandlers>
.NET 3.5:
<?xml version="1.0"?>
<configuration>
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.webServer>
<modules>
<add name="DomainServiceModule" preCondition="managedHandler" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"/>
</modules>
<system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
</configuration>
.NET 4.0:
<?xml version="1.0"?>
<configuration>
<system.web>
<httpModules>
<add name="DomainServiceModule" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="DomainServiceModule" preCondition="managedHandler"
type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</configuration>
using System.Web.DomainServices.LinqToEntities;
To this:
using System.Web.DomainServices.Providers;
Everywhere.
Now, your Web application should build, but you may still get this error while building the actual Silverlight application:
Error 5 The "CreateRiaClientFilesTask" task failed unexpectedly. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The AutoGenerateField property has not been set. Use the GetAutoGenerateField method to get the value. at System.ComponentModel.DataAnnotations.DisplayAttribute.get_AutoGenerateField()
In my case, this was a problem with the System.ComponentModel.DataAnnotations.dll reference. Remove it and re-add it from the Global Assembly Cache.
Replace System.Windows.Ria.Controls with System.Windows.Controls.Ria in your namespace declarations in the header of the XAML file. Here’s how the old ones look:
xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls" xmlns:System_Windows_Data="clr-namespace:System.Windows.Data;assembly=System.Windows.Ria.Controls"
<Application.ApplicationLifetimeObjects>
<app:WebContext>
<app:WebContext.Authentication>
<appsvc:FormsAuthentication/>
<!--<appsvc:WindowsAuthentication/>-->
</app:WebContext.Authentication>
</app:WebContext>
</Application.ApplicationLifetimeObjects>
With some luck, your project should be migrated to WCF RIA Services now. These were the steps I needed to get mine working.
Additional breaking changes in the new release can be found here.
Good luck!
November 25, 2009 - 10:50 pm
Thanks for your post…
We also had the problem whose resolution is described here:
http://forums.silverlight.net/forums/p/146675/326732.aspx
December 1, 2009 - 4:22 pm
Thanks a lot for the post!!!
December 6, 2009 - 2:40 pm
This saved me several hours of work. Thanks a ton.
December 6, 2009 - 10:17 pm
Thanks for working this out for the rest of us. I’m going to migrate my project tonight.
December 9, 2009 - 8:30 am
Nice one – this saved me a lot of hassle!
December 26, 2009 - 9:36 am
Great post!
Very helpful.
Thanks,
– Justin Angel