使用silvlight4.0开发,部署到IIS6.0时报错
错误信息如下:
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. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: 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.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
[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.]
   System.Web.Compilation.MultiTargetingUtil.ValidateCompilerVersionFor40AndAbove(String compilerVersion) +235
   System.Web.Compilation.MultiTargetingUtil.ValidateCompilerVersionFor40AndAbove() +76
   System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkName() +101
   System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized() +149
   System.Web.Compilation.BuildManager.Initialize() +204
   System.Web.Compilation.BuildManager.InitializeBuildManager() +246
   System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +350[HttpException (0x80004005): 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.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8946548
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

解决方案 »

  1.   

    1.部署的机器上的.net框架版本低于4.0
    2.删除在Web.config文件的<compilation>元素'targetFramework'属性
      

  2.   

    在windows2003上通过IIS6.0部署一个silverlight网站与部署其他网站基本一致,但是有几点特别需要注意的地方,掌握了这几个小窍门,就可以轻松部署你的silverlight网站了。  下面我们以一个利用ASP.net2.0 webservice访问后台数据,通过Linq链接SQLserver2005数据库的silverlight网站为例,来说明这些注意事项。  1、Windows2003安装IIS6.0后,默认80端口没有访问权限,需要在Windows防火墙内打开TCP的80端口,否则外网无法链接本机Web服务。  2、注意更改您的silverlight的“web引用”的URL,使其与你发布的真实域名一致,否则silverlight无法正确调用您的WebService(因为silverlight不能跨域调用,所以WebService要与silverlight部署在同一个域内)。具体就是修改Reference.cs文件中URL字符串的赋值,然后重新编译整个工程。  3、在IIS中为您的silverlight目录建立一个新网站,端口“80”,IP地址“全部未分配”。  4、将“主目录”中“执行权限”参数设置为“纯脚本”,否则您的网站在访问时会报错“silverlight error 2252”。  5、注意修改您的数据库链接字符串,使其正确的指向您的sql2005数据库。  6、将网站的ASP.net版本设置为2.0  7、要保证“IUSE”用户和“NET SERVER”具有访问(读取和执行)你网站文件目录的权限。  好了,至此,您的silverlight网站就可以正常的被Internet访问了!
      

  3.   

    还有就是要注意你的.NET Framework版本要对应
      

  4.   

    已经安装了.net framework4.0,编译也是使用4.0编译的,在visual studio 2010下编译的
      

  5.   

    你那个iis里站点属性有个iis版本的选项,你选4.0了么?
      

  6.   

    你机器上装过低版本的.net,把你部署的代码改成4.0就可以了
      

  7.   

    来看看 servlight 没看过 
      

  8.   

    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. 这话很明白,就是版本的问题。
    你发布机器上的版本是不是不存在代码中应该的版本?
      

  9.   

    http://social.msdn.microsoft.com/Forums/en/webdevelopmentprerelease/thread/4c42b9af-d298-4731-91eb-0f52c9c05251