我最近尝试使用 dotnetcore 运行一些代码时遇到了错误。当我尝试在控制台中运行该项目(dotnet run)时,出现此错误。
无法运行您的项目。确保您有可运行的项目类型并确保“dotnet run”支持该项目。可运行的项目应以可运行的 TFM(例如 netcoreapp2.0)为目标,并具有 OutputType“Exe”。当前的输出类型是“Exe”。
仅供参考,以下是 .csproj 文件中的条目
另外,我安装了以下 skd 和运行时。然而,无论我在 .csproj 中设置什么 TargetFramework,我都会遇到相同的错误。
我正在尝试使用以下代码段对我的 JWt 进行签名和编码:
var claims = new Claim[] { new SomeClaimes() };
var scKey = Encoding.UTF8.GetBytes("SOME KEY");
var ecKey = Encoding.UTF8.GetBytes("SOME OTHER KEY");
var tokenDescriptor = new SecurityTokenDescriptor {
Subject = new ClaimsIdentity(claims),
SigningCredentials = new SigningCredentials(
new SymmetricSecurityKey(
scKey),
SecurityAlgorithms.HmacSha512),
EncryptingCredentials = new EncryptingCredentials(
new SymmetricSecurityKey(
ecKey),
// I tryied all possible combination of algorithms here:
SecurityAlgorithms.XXXX,
SecurityAlgorithms.YYYY),
Issuer = "My Jwt Issuer",
Audience = "My Jwt Audience",
IssuedAt = DateTime.UtcNow,
Expires = DateTime.Now.AddDays(7),
};
var tokenHandler = new …
Run Code Online (Sandbox Code Playgroud) 我有 Angular CLI 应用程序和 Dot net core 2.0 Web API。我需要将文件从 Angular 上传到 Web API。从 Web API 到服务器。当我使用 Http 时它工作正常。使用 HttpClient 时,它不起作用。这是我的 component.ts 代码:
fileChange(event, grdvalue) {
debugger;
let fileList: FileList = event.target.files;
if (fileList.length > 0) {
let file: File = fileList[0];
const formData: FormData = new FormData();
let GridName = grdvalue;
formData.append('file', file, file.name);
formData.append('Id', this.userId);
formData.append('GridValue', GridName)
this.myService.PostFileToAzure(formData).subscribe(details => {
debugger;
},
(error) => {
debugger;
})
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的服务代码:
PostFileToAzure(form) {
debugger;
var body = JSON.stringify(form);
return …
Run Code Online (Sandbox Code Playgroud)