LINQ issue when deployed to WinHost
I have a relatively simple ASP.net MVC 2 app that is using SubSonic. Everything seems to work well locally, but when I deployed it to WinHost, I keep getting an exception like so:
System.TypeAccessException: Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Data.Common.DbD开发者_开发技巧ataReader)' to access type 'System.RuntimeType' failed.
at lambda_method(Closure , DbDataReader )
at SubSonic.Linq.Structure.DbQueryProvider.Project[T](DbDataReader reader, Func`2 fnProjector)
at SubSonic.Linq.Structure.DbQueryProvider.Execute[T](QueryCommand`1 query, Object[] paramValues)
at lambda_method(Closure )
at SubSonic.Linq.Structure.DbQueryProvider.Execute(Expression expression)
at SubSonic.Linq.Structure.QueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at Foo.Web.Data.Baz.SingleOrDefault(Expression`1 expression)
at Foo.Web.Models.Data.DataFacade.GetBar(Int32 id)
at Foo.Web.Controllers.Baz.Edit(Int32 id)
at lambda_method(Closure , ControllerBase , Object[] )
It's definitely a head scratcher as I am not sure what specifically I am doing wrong. My assumption is that its environmental (possibly permissions based). I am not sure if its a LINQ query issue, SubSonic, or something specific to WinHost. Does anyone have an idea on how I should approach this or where/what the issue is? Once more, the app works fine locally.
Note: the object/method names are changed in the sample
This looks like a medium trust issue. Current releases of subsonic do not support medium trust. If you pull the latest from github (http://github.com/subsonic/SubSonic-3.0) apprently a change on July 10th enabled medium trust. I have tried it myself but the source is pretty reliable.
Have you tried changing the trust level of your application?
精彩评论