Mayur A Muley
Mayur A Muley

Reputation: 61

Issues on Win Host godaddy

I have simple mvc 4 application which tries to read data from a CSV file from server. When running on Local Host, it works fine. But when I uploaded app to godaddy server, I am getting following error while trying to read the file

System.TypeAccessException: Attempt by method 'DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure)' to access type 'System.Linq.OrderedEnumerable2<CSVU.Models.DataTableEntry,System.Int32>' failed. at lambda_method(Closure ) at System.Linq.EnumerableExecutor1.Execute() at System.Linq.EnumerableQuery1.System.Linq.IQueryProvider.Execute[S](Expression expression) at System.Linq.Queryable.Count[TSource](IQueryable1 source) at PagedList.PagedList1..ctor(IQueryable1 superset, Int32 pageNumber, Int32 pageSize) at PagedList.PagedList1..ctor(IEnumerable1 superset, Int32 pageNumber, Int32 pageSize) at PagedList.PagedListExtensions.ToPagedList[T](IEnumerable1 superset, Int32 pageNumber, Int32 pageSize) at CSVU.Controllers.FilesController.ViewCSVData(Int32 id, Nullable1 page) in G:\Mayur Muley\Project\Caliber Group\CSVU\CSVU\Controllers\FilesController.cs:line 200 at

There are many more lines of it..

Upvotes: 0

Views: 256

Answers (2)

Mayur A Muley
Mayur A Muley

Reputation: 61

I got it resolved.. I dont know how but following are solutions I tried. Each solution must use its predecessor solution. For each solution I published app to godaddy with newer assemblies.

  1. I tried signing my assembly.

  2. When I was paging a list of my custom object. I wrote this code

var temp = myPrevList.OrderBy(x=> x.IntegerColumn);
IPagedList listToSendToView = temp.ToPagedList(1,10);

Instead of this

IPagedList listToSendToView = myPrevList.OrderBy(x=> x.IntegerColumn).ToPagedList(1,10);

  1. Then tried changing trust level by signing assembly with different key.

  2. Then tried solution suggested by @timothyclifford of implementing security roles, here I tried Level1. Published to godaddy. -> got no +ve results

  3. Then tried Level2, same outcomes produced, no use.

  4. Then tried None level, same outcomes produced, no use.

  5. Finally I tried removing security rule set in step 4,5,6 and published and MIRACLE... IT worked..! I still don't know how and why it worked.

Thanks @timothyclifford.

Upvotes: 0

timothyclifford
timothyclifford

Reputation: 6969

Reading https://github.com/troygoode/PagedList/issues/68

It sounds like GoDaddy have some legacy/weird security configurations.

Have you tried adding the following to your AssemblyInfo.cs file?

[assembly: SecurityRules(SecurityRuleSet.Level1)]

It may also be possible you're compiling to .NET4 but GoDaddy is .NET2, I would check this also to be sure.

More reading here https://msdn.microsoft.com/en-us/library/system.security.securityruleset(v=vs.110).aspx

Upvotes: 1

Related Questions