我正在尝试向 Visual Studio 2013 中的 ASP.NET MVC 5 项目添加视图,但“添加”按钮呈灰色。

前段时间我在Windows 7 64位上将TortoiseSVN更新为1.7.7(64位).从那时起,我没有关于文件的SVN上下文菜单.当我右键单击文件夹时,我确实有上下文菜单,但有时我想对文件进行差异或更改,这是不可能的.
我试图重新安装和修复,但它没有用.我该怎么办?
在我的API中,我有以下代码:
public class CustomOAuthProvider : OAuthAuthorizationServerProvider
{
public override Task MatchEndpoint(OAuthMatchEndpointContext context)
{
if (context.OwinContext.Request.Method == "OPTIONS" && context.IsTokenEndpoint)
{
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Methods", new[] { "POST" });
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Headers",
new[] {
"access-control-allow-origin",
"accept",
"x-api-applicationid",
"content-type",
"authorization"
});
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
context.OwinContext.Response.StatusCode = (int)HttpStatusCode.OK;
context.RequestCompleted();
return Task.FromResult<object>(null);
}
return base.MatchEndpoint(context);
}
// ... even more code, but not relevant
}
Run Code Online (Sandbox Code Playgroud)
当我从Chrome连接到此API时,一切都很完美.当我从同一台计算机连接到同一个API,但只从另一个浏览器Internet Explorer 11,我收到以下错误:
SEC7123:Access-Control-Allow-Headers列表中不存在请求标头x-api-applicationid.
我调试了代码,我看到标题已添加到响应中.甚至IE显示标题:

IE期待什么?
更新
如果我更改标题的顺序
new[] {
"access-control-allow-origin",
"accept",
"x-api-applicationid",
"content-type",
"authorization"
}
Run Code Online (Sandbox Code Playgroud)
至:
new[] {
"content-type",
"accept",
"access-control-allow-origin", …Run Code Online (Sandbox Code Playgroud) 我创建了一个密码验证器,如下所示:
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 8,
RequireNonLetterOrDigit = false,
RequireDigit = false,
RequireLowercase = true,
RequireUppercase = true,
};
Run Code Online (Sandbox Code Playgroud)
但是,测试123之类的密码被视为无效:
密码必须至少包含一个非字母或数字字符.
错误消息非常不清楚,它说密码应该至少有一个非字母或数字字符.好吧,我有3位数.那有什么不对呢?当我添加一个非字母
我刚刚阅读了Asp.net MVC3教程(模型(数据))
在ASP.NET网站上的这个页面教程4 of 10中,显示了一个实体图是从代码优先类创建的.如何生成它们?
使用实体框架代码首先,Web应用程序在调用DbContext时崩溃,并出现以下错误:
断言失败
表达式:primitiveType!= null
描述:断言失败:primitiveType!= null
它在以下代码行崩溃:
public class MyDb : DbContext {
Run Code Online (Sandbox Code Playgroud)
被称为:
MyDb _db = new MyDb();
Run Code Online (Sandbox Code Playgroud)
因此,调用DbContext会产生致命错误.DbContext是一个EF函数,我无法在EntityFramework.dll中调试
我正在使用ASP.NET身份提供程序和EF 6 Code First,我创建了一个IdentityUserRole具有额外列的自定义表OrganisationId.自定义表名为UserRole.
该表当前具有默认主键UserId和RoleId.
我想将OrganisationId列包含在IdentityUserRole表的主键中.
我可以在我的数据库中看到UserRole表,它是用于用户用户的表(没有aspnet_userrole表,当我为用户分配角色时表有数据)
我试过这个:
modelBuilder.Entity<IdentityUserRole>().ToTable("UserRole").HasKey(x => new { x.UserId, x.RoleId });
Run Code Online (Sandbox Code Playgroud)
但它没有向我展示OrganisationId属性.
所以我尝试过:
modelBuilder.Entity<UserRole>().HasKey(x => new { x.OrganisationId, x.RoleId, x.UserId });
Run Code Online (Sandbox Code Playgroud)
但是当我添加迁移时,Up和Down方法都是空的.
更新(一些代码)
IdentityUserRole类:
public class UserRole : IdentityUserRole, IOrganisationEntity
{
[Key]
public int OrganisationId { get; set; }
[ForeignKey("OrganisationId")]
public Organisation Organisation { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
DbContext继承自 IdentityDbContext<User>
并User继承自IdentityRebootUser
更新2
这是新的DbContext:
public class MyDbContext : IdentityDbContext<User, Role, string,
IdentityUserLogin, UserRole, IdentityUserClaim>
Run Code Online (Sandbox Code Playgroud)
这是我的新用户类:
public …Run Code Online (Sandbox Code Playgroud) 我有一个使用EF Core 2的项目.我创建了一个迁移.运行迁移时,它返回以下错误:
infoinfo: System.Data.SqlClient.SqlException (0x80131904): There is already an object named 'Clients' in the database.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
at …Run Code Online (Sandbox Code Playgroud) 在asp.net核心2中,添加了一个重大更改,将请求大小限制为30 mb(源)。
在该文章中,如果您想推翻30 mb的限制,则提供了一种解决方案。应该通过向操作添加属性来完成此操作,如下所示:
[HttpPost]
[RequestSizeLimit(100_000_000)]
public IActionResult MyAction([FromBody] MyViewModel data)
{
Run Code Online (Sandbox Code Playgroud)
当我这样做并重建项目时,在Kestrel中仍然出现以下错误:
An unhandled exception has occurred while executing the request
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Request body too large.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame.ThrowRequestRejected(RequestRejectionReason reason)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.ForContentLength.OnReadStart()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.TryInit()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.<ReadAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameRequestStream.<ReadAsyncInternal>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() …Run Code Online (Sandbox Code Playgroud) kestrel-http-server asp.net-core asp.net-core-2.0 asp.net-core-mvc-2.0