我有Asp.netCore解决方案,工作正常Visual Studio 2015,然后我搬到了Visual Studio 2017.现在问题是在Visual Studio 2017每个nuget包中都有黄色感叹号.以下是迄今为止我尝试过的解决方案.
我正在使用 Visual Studio Version: 15.3.1
Clear All Nugget Cache(s)来自Tools > options > NuGet Package Manager >并再次恢复Nuget.注意:我已搜索并找到以下解决方案并尝试但未解决我的问题.
我ng2-signalr在离子2中使用库.问题是我不知道如何设置授权头.我有搜索,但没有找到任何例子.
我的连接到服务器中心的代码.
let options: IConnectionOptions = { qs:{userId:1}, url: "http://192.168.0.211:44337"};
console.log("Stage 1");
//Header for 'this.singalR.connect'
this.signalR.connect(options)
.then((connection) => {
console.log("Client Id: " + connection.id);
}, (err) => {
console.log("SignalR Error: " + JSON.stringify(err));
});
Run Code Online (Sandbox Code Playgroud)
如何设置下面的标题?
var headers = new Headers({
'Content-Type': "application/json",
"Authorization": 'Bearer ' + accessToken //accessToken contain bearer value.
});
Run Code Online (Sandbox Code Playgroud)
图书馆:ng2-signalr
更新1
这里是链接Query String Solution.一种解决方法是提传递authorization token中qs和相应的处理.但我想设置标题,所以这个解决方案不适合我.另一个原因,因为我有另一个客户端(简单angularjs信号器),当我设置标头就像下面工作正常.
$.signalR.ajaxDefaults.headers = { Authorization: //here set header};
Run Code Online (Sandbox Code Playgroud)
注意:在实现授权之前,相同的代码工作正常,因为我不需要设置授权标头.
我使用的库"FluentValidation.AspNetCore": "6.4.0-beta3"中.netcore WebApi的一个项目。您可以在下面看到项目结构。如果我将 CurrencyDTO.cs代码放在第2节(Project FH.WebAPI)中,并且如果将相同的代码放在第1节(Class Library DTO)中,则库工作正常。要求是我必须将代码放置在Class库中FH.Common。周围有什么解决办法。我已经搜索了,但是没有找到任何东西
项目结构
CurrencyDTO.cs
[Validator(typeof(CurrencyDTOValidator))]
public class CurrencyDTO
{
public int Id { get { return CurrencyId; } }
public int CurrencyId { get; set; }
public string Name { get; set; }
public string Symbol { get; set; }
}
public class CurrencyDTOValidator : AbstractValidator<CurrencyDTO>
{
public CurrencyDTOValidator()
{
RuleFor(x => x.Name).NotEmpty().NotNull().WithMessage("The currency 'Name' is required.")
.Length(0, 250).WithMessage("The currency 'Name' cannot be more than 250 characters.");
RuleFor(x …Run Code Online (Sandbox Code Playgroud) 我正在使用EF6代码优先的方法来创建数据库。当我添加迁移和更新数据库时,它总是Non-cluster Index默认为表中的每个外键创建。
我的问题: EF6 是否有任何全局设置不能Non-Cluster index在外键上创建?
我已经搜索并找到了以下解决方案
解决方案 1 不适合我,因为我有很多表,而且我的表db已经创建好了。手动删除索引创建行需要很多时间。
此外,我也在使用fluent api是否有与此问题相关的任何选项?