我正在做一个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) 在尝试使用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)