在ASP.NET中拒绝用户时,’CustomIdentity’上的SerializationException
我尝试在现有数据库的基础上实现ASP.NET身份验证和授权.
只要允许用户访问该页面,它就能完美运行.但是当用户被拒绝时,框架会在我的CustomIdentity上抛出序列化异常,而不是抛出AccessDeniedException. 我的例外情况与上面的链接完全相同 Type is not resolved for member'CW.CustomAuthentication.CWIdentity,CW.CustomAuthentication,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 'CW.CustomAuthentication.CWIdentity,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 'CW.CustomAuthentication.CWIdentity,PublicKeyToken=null'.] Microsoft.VisualStudio.WebHost.Connection.get_RemoteIP() +0 Microsoft.VisualStudio.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 eventArgs) +8777783 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously) +75 同时使用会员资格和自定义IIdentity和IPrincipal是否正确? 最好的祝福, Stephane Erbrech 解决方法经过一些更多的测试,根据我发布的链接说,似乎只有当我从visual studio运行调试模式时才会发生此错误.如果我将项目设置为在IIS中运行,则错误消失,安全实现按预期工作.—这是Visual Studio中实现的轻量级网络服务器中的一个错误吗?— 编辑:您可以进入Web项目的属性,转到“Web”选项卡,然后选中“使用本地IIS服务器”.但是,这将要求您以管理员身份运行Visual Studio并在计算机上安装IIS,以便VS在加载项目时可以在本地IIS服务器中创建虚拟目录. (编辑:甘南站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- .net – DNU发布 – 来自MSBuild的no-source
- asp.net – Visual Studio – 为什么.ASPX文件比.ASPX.CS文
- 勾选复选框时,禁用一些ASP.Net验证控件
- asp.net-mvc – ASP.NET MVC现在是“开源”.这是一件好事吗
- asp.net实现文件下载的代码
- ASP.NET MVC Web应用程序中视图逻辑和域逻辑之间的混淆
- 是否可以直接路由到MVC应用程序中托管的blazor页面
- asp.net-mvc – ASP.NET MVC jQueryUI datepicker在使用AJA
- asp.net – 使用WebMethods和session时的最佳实践
- asp.net-mvc – MVC应用程序中的随机数生成
- 在ASP.NET中使用querystring的最佳做法?
- asp.net-mvc – Windows 8 VS2012 IISExpress Wi
- asp.net-mvc – ASP.NET MVC中的WebApi [FromUri
- User.Identity始终为null
- asp.net – 我想列出我的下拉列表中的所有国家/地
- asp.net-mvc – ASP.NET MVC Beta 1:DefaultMod
- ASP.NET 5针对dnx451 / dnx46性能
- asp.net – 双回发问题
- asp.net-core – 如何在Visual Studio 2015 RC中
- asp.net – 多个用户控件和JavaScript