문제

I'm having difficulty with my project and deploying it on my web hosting provider. I'm on a shared hosting environment with "Host Level" trust.

I have used LINQ in my project but now they've just told me that Reflection is disabled on their shared services. I believe that reflection is required to be able to use variables within the queries.

When I run the project in the host level trust environment, I get an Exception:

MethodAccessException:
System.Runtime.CompilerServices.StrongBox`1..ctor(System.__Canon)

Does anyone have any experience in this area? Any suggestions would be greatly appreciated

It's failing on this code:

public override bool ValidateUser(string username, string password) {

   using (var dc = new mcDataContext()) {
      var query = (from c in dc.CF_Clients
                   where c.Client_ID == username
                   select new
                   {
                      c.Client_Password
                   }).FirstOrDefault();

  }
}
도움이 되었습니까?

해결책

다른 팁

Try replacing

from c in dc.CF_Clients

with

from Client c in dc.CF_Clients

Or whatever your type is (in this case I assumed it is a Client object). If you implicitly cast the objects from the collection, then it shouldn't have to use reflection to access the properties in the query.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top