我将 aspnetboilerplate 与 Angular 和 .NET Core 一起使用。当我尝试在 Azure 上部署应用程序时,它显示:
致命错误:接近堆限制的无效标记压缩分配失败 - JavaScript 堆内存不足
这是我的天蓝色管道:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: |
npm install -g @angular/cli
npm install
npm run build-prod
ng build --c=production
displayName: 'npm install and build'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)/dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
CleanTargetFolder: true
OverWrite: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Run Code Online (Sandbox Code Playgroud)
并在 package.json 文件中添加了build-prod属性。 …
在我的解决方案中,我有一个 aspnet core 2.2 WebApp,我想添加一个现有项目,例如 webJob,但没有选项:从现有项目添加 WebJobs
为什么?使用相同的过程,我在其他 .Net 应用程序上添加 WebJobs,该选项显示在 Visual Studio 2019 中
编辑
用英语更改图像。有时,“添加”>“现有项目”会显示为 Azure WebJobs,但如果我单击它,则会显示以下错误:
(选择的项目是aspnet.core 2.2.WebApp)
单击此按钮后,“添加”>“作为 Azure WebJobs 的现有项目”将不再可见。
c# azure-webjobs azure-webjobssdk asp.net-core visual-studio-2019
我正在尝试将一条记录插入到自动生成 ID 的表中。出于这个原因,这是我的代码:
using (var context = new DbContext(GetConnection().Options))
{
context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Customers ON;");
context.SaveChanges();
context.Customers.Add(customer);
context.SaveChanges();
context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Customers OFF;");
}
Run Code Online (Sandbox Code Playgroud)
但例外总是一样的:
当 IDENTITY_INSERT 设置为 OFF 时,无法为表“Customers”中的标识列插入显式值。
我还尝试SET IDENTITY_INSERT dbo.Customers ON在 SQL Server Management Studio 中手动执行命令,并在执行上面的代码后,但抛出了相同的异常。
为什么?
在 Net Core 3.1 应用程序中,我尝试使用 AutoMapper.Extensions.Microsoft.DependencyInjection 7。在解决方案中,我有 3 个项目:
nuget安装后,这是我的代码:
内容项目中的 Startup.cs:
using AutoMapper;
using Project.Content.EntityFrameWork;
using Project.Content.Dto;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Project.Content
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
// Auto Mapper …Run Code Online (Sandbox Code Playgroud) 我正在使用用 ASP.NET core 2.2 开发的 aspnetboilerplate 解决方案。后端部署在 azure 上,并使用提供的 SQL 服务器。
有时,当后端有很多请求要处理时,它会记录此异常:
错误 2020-11-20 12:28:21,968 [85] Mvc.ExceptionHandling.AbpExceptionFilter - 由于数据到达太慢,读取请求正文超时。请参阅 MinRequestBodyDataRate。Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException:由于数据到达太慢,读取请求正文超时。请参阅 MinRequestBodyDataRate。
我试图解决这个问题,将此代码添加到我的 Program.cs
namespace WorkFlowManager.Web.Host.Startup
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel(options =>
{
options.Limits.MinResponseDataRate = null;
});
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
}
Run Code Online (Sandbox Code Playgroud)
但问题并没有解决。
c# sql-server azure-devops aspnetboilerplate asp.net-core-2.2
c# ×4
asp.net-core ×2
sql-server ×2
automapper ×1
azure ×1
azure-devops ×1
ng-build ×1
node.js ×1