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.DbDataReader)' 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