Today, I encountered a strange problem. Although the problem has been solved, the cause is still unclear.
A custom identity is used in the newly created ASP. net mvc. When debugging with the webserver that comes with vs, the following error occurs:
Type is not resolved for member 'xassembly, version = 1.0.0.0, culture = neutral, publickeytoken = null '. 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. runtime. serialization. serializationexception: type is not resolved for member 'xassembly. myidentity, xassembly, version = 1.0.0.0, culture = neutral, publickeytoken = null '. 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: [serializationexception: type is not resolved for member 'xassembly. myidentity, xassembly, version = 1.0.0.0, culture = neutral, publickeytoken = null'.] microsoft. visual Studio. webhost. connection. get_remoteip () + 0 Microsoft. visual Studio. webhost. request. getremoteaddress () + 65 system. web. httprequest. get_userhostaddress () + 18 system. web. httprequest. get_islocal () + 13 system. web. configuration. customerrorssection. customerrorsenabled (httprequest request) + 86 system. web. httpcontext. get_iscustomerrorenabled () + 42 system. web. configuration. urlauthfailederrorformatter. geterrortext (httpcontext context) + 16 system. web. security. urlauthorizationmodule. writeerrormessage (httpcontext context) + 29 system. web. security. urlauthorizationmodule. onenter (Object source, eventargs) + 8777783 system. web. synceventexecutionstep. system. web. httpapplication. iexecutionstep. execute () + 68 system. web. httpapplication. executestep (iexecutionstep step, Boolean & completedsynchronously) + 75
The sameCodeWhen IIS or IIS Express is used for debugging or running, no error occurs.
At first, I tried to add attribute [serializable] As prompted, but the error persists.
Later, we defined the original identity
Public ClassMyidentity: iidentity {//...}
Change
Public ClassMyidentity: financialbyrefobject, iidentity {//...}
That is to solve the problem, but the cause is still unknown. From an exception, it seems to be a bug in webserver.
References:
http://stackoverflow.com/questions/1277371/serializationexception-on-customidentity-when-user-is-denied-in-asp-net