Solution for serializationexception in custom identity when using webserver for debugging in ASP. NET

Source: Internet
Author: User
Tags webhost

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.