求教,asp.net mvc3使用CAS单点认证报错。

zhangshaohua01 2012-02-14 02:56:18
登录的时候能跳转到服务端的地址

[Authorize]
public ActionResult Login()
{
return View();
}

登录后能获取到票据,
在服务端地址登录后返回view出现如下错误,
Server Error in '/' Application.
Type is not resolved for member 'DotNetCasClient.Security.CasPrincipal,DotNetCasClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=bb0f1feb6ffbaa19'.
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 'DotNetCasClient.Security.CasPrincipal,DotNetCasClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=bb0f1feb6ffbaa19'.

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 'DotNetCasClient.Security.CasPrincipal,DotNetCasClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=bb0f1feb6ffbaa19'.]
Microsoft.VisualStudio.WebHost.Connection.get_RemoteIP() +0
Microsoft.VisualStudio.WebHost.Request.GetRemoteAddress() +65
System.Web.HttpRequest.get_IsLocal() +23
System.Web.Configuration.CustomErrorsSection.CustomErrorsEnabled(HttpRequest request) +86
System.Web.HttpContextWrapper.get_IsCustomErrorEnabled() +45
System.Web.Mvc.HandleErrorAttribute.OnException(ExceptionContext filterContext) +72
System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception) +115
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +323
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8969117
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
=============================================================================================================
登出的时候客户端会报异常,服务端都会出现警告。

public ActionResult LoginOut()
{
CasAuthentication.SingleSignOut();
return RedirectToAction("Index", "Home");
}
public static void SingleSignOut()
{
Initialize();

HttpContext context = HttpContext.Current;
HttpResponse response = context.Response;


// Necessary for ASP.NET MVC Support.
if (context.User.Identity.IsAuthenticated)
{
ClearAuthCookie();
string singleSignOutRedirectUrl = UrlUtil.ConstructSingleSignOutRedirectUrl();

// Leave endResponse as true. This will throw a handled ThreadAbortException
// but it is necessary to support SingleSignOut in ASP.NET MVC applications.
response.Redirect(singleSignOutRedirectUrl, true); //报异常
}
}

SerializationException was unhandled by user code
Type is not resolved for member 'DotNetCasClient.Security.CasPrincipal,DotNetCasClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=bb0f1feb6ffbaa19'.
===========================================================================================
服务端容器报警告。
WARN [org.jasig.cas.util.HttpClient] - <Error Sending message to url endpoint [http://localhost:7684/Home/Index]. Error is [Connection refused: connect]>
INFO [org.jasig.cas.services.DefaultServicesMessageImpl] - <Reloading registered sservices.>
INFO [org.jasig.cas.services.DefaultServicesMessageImpl] - <Loaded 4 services.>

...全文
705 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
baidu_17080261 2014-06-30
  • 打赏
  • 举报
回复
你好,我也遇到这样的问题 mvc4 ,死循环跳转,可以把你的demo 给我发一个吗? 谢谢
_Victor_king_ 2014-05-22
  • 打赏
  • 举报
回复
引用 6 楼 zhangshaohua01 的回复:
[quote=引用 4 楼 liang10024 的回复:] 你好,我现在做相关的项目。可以发下你的demo我看吗
好久没登了, 如果你的项目是用的asp.net web项目使用的.aspx页面方式就不会有问题,cas对.cshtm当时是不支持的。可在mvc项目中添加一个空的.aspx页面来做中转有点麻烦。[/quote] 你好,我正在用.net mvc 3 对接CAS,出现了同样的问题,确实如你所说.aspx的可以,.cshtml的就不行。你说的增加一个.aspx的中转页面可以解决,我还是没解决掉。我是在.aspx页面里加了一个javascript,页面直接跳转至**/Home/Index 这样还是不行。。。请问该怎么做?
zhangshaohua01 2013-07-18
  • 打赏
  • 举报
回复
引用 4 楼 liang10024 的回复:
你好,我现在做相关的项目。可以发下你的demo我看吗
好久没登了, 如果你的项目是用的asp.net web项目使用的.aspx页面方式就不会有问题,cas对.cshtm当时是不支持的。可在mvc项目中添加一个空的.aspx页面来做中转有点麻烦。
SMG008 2013-04-25
  • 打赏
  • 举报
回复
引用 3 楼 zhangshaohua01 的回复:
已经解决。
是怎么解决的,麻烦提供一下解决方案
liang10024 2012-08-17
  • 打赏
  • 举报
回复
你好,我现在做相关的项目。可以发下你的demo我看吗
zhangshaohua01 2012-02-28
  • 打赏
  • 举报
回复
已经解决。
jiuhexuan 2012-02-14
  • 打赏
  • 举报
回复
http://www.cnblogs.com/borllor/archive/2008/02/16/1070308.html

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧