.Net WCF RIA Services – Error When Moving Service To Server

1 Comment

I recently tried publishing a WCF RIA Service to my server, and came across an error.  I was using all the latest Windows Phone 7 and RIA Services Tools, and targeting the .Net 4 framework.  However, since I have both .Net 3.5 and .Net 4 installed on my server, I ran into this error…

WCFError1

“System.Configuration.ConfigurationErrorsException: The value for the ‘compilerVersion’ attribute in the provider options must be ‘v4.0′ or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the ‘targetFramework’ attribute from the <compilation> element of the Web.config file.”

It threw me for a loop because it worked fine in Visual Studio 2010 when testing on my development PC, but when moving it to the server, it had this problem.

The fix was fairly easy, once I was able to find it.  Basically, you need to add the a section to the web.config that doesn’t get added when adding the RIA Services DomainService to the project.

<system.codedom>
  <compilers>
     <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
       <providerOption name="CompilerVersion" value="v4.0" />
       <providerOption name="WarnAsError" value="false" />
     </compiler>
  </compilers>
</system.codedom>

Tags: , ,

One Response to “WCF RIA Services – Error When Moving Service To Server”

  1. Chara Neumeyer Says:

    Implications of Robotics, Calo is writing a chapter on the potential impact of robots on privacy (access sample excerpt of the chapter from Stanford Law website).

Leave a Reply