相关疑难解决方法(0)

名为"x"的路径已在路径集合中.路线名称必须是唯一的.ASP.NET MVC 3的例外

我正在做一个ASP.NET MVC 3 Web服务,我一直在间歇性地得到这个例外.

堆栈跟踪:

Server Error in '/' Application.

A route named 'ListTables' is already in the route collection. Route names must be unique.
Parameter name: name

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.ArgumentException: A route named 'ListTables' is already in the route collection. Route names must be unique.
Parameter name: name …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc-3-areas asp.net-mvc-3

95
推荐指数
4
解决办法
6万
查看次数

Sequence包含多个元素Microsoft.Owin.Security.AuthenticationManager

在尝试使用Google进行外部身份验证时,应用程序会给我以下异常:

<错误> <消息>发生错误.<ExceptionMessage> Sequence在System.Linq.Enumerable.SingleOrDefault [TSource]中包含多个元素</ ExceptionMessage> <ExceptionType> System.InvalidOperationException </ ExceptionType> <StackTrace> 1 source) at Microsoft.Owin.Security.AuthenticationManager.<AuthenticateAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter(System.Web.Http中的IEnumerable 1.GetResult() .HostAuthenticationFilter.d__0.MoveNext()---在抛出异常的前一个位置的堆栈跟踪结束---在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)处( System.Web.Http.Controllers.AuthenticationFilterResult.d__0.MoveNext()中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()处的任务任务)从抛出异常的先前位置开始的堆栈跟踪结束---在系统中System.W上System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中的.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)eb.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()

我已将Web Api oAuth配置如下:

public void ConfigureOAuth(IAppBuilder app)
{
    app.UseExternalSignInCookie(
        Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ExternalCookie);

    OAuthBearerOptions = new OAuthBearerAuthenticationOptions();

    OAuthAuthorizationServerOptions OAuthServerOptions = 
        new OAuthAuthorizationServerOptions()
    {
        AllowInsecureHttp = true,
        TokenEndpointPath = new PathString("/token"),
        AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
        Provider = new SimpleAuthorizationServerProvider(),
    };

    app.UseOAuthAuthorizationServer(OAuthServerOptions);

    app.UseOAuthBearerAuthentication(OAuthBearerOptions);

    googleAuthOptions = new …
Run Code Online (Sandbox Code Playgroud)

c# google-authentication oauth-2.0 owin asp.net-web-api2

5
推荐指数
2
解决办法
2844
查看次数