我在 .NET Core 6 上遇到了一个相对较新的问题,当通过 Visual Studio 2022 使用 Web Deploy 进行发布时。我收到以下错误:
错误发现多个具有相同相对路径的发布输出文件:C:\Work\MySolution\A\appsettings.json、C:\Work\MySolution\B\appsettings.json、C:\Work\MySolution\A\appsettings.Staging .json、C:\Work\MySolution\B\appsettings.Staging.json、C:\Work\MySolution\A\appsettings.Development.json、C:\Work\MySolution\B\appsettings.Development.json
构建时没有问题,只需发布即可。
我有两个 ASP.NET Core 6 项目。项目“A”引用项目“B”(我知道B确实应该是一个类库,但请跟我一起)。
我知道这是 .NET Core 6 中的预期功能(https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/6.0/duplicate-files-in-output)。但是,我似乎无法告诉项目“A”忽略项目“B”appsettings 文件。我知道我可以设置 ErrorOnDuplicatePublishOutputFiles 属性,但我试图严格告诉它不要包含这些文件。
以下是我尝试过但不起作用的一些项目示例。
示例 1:尝试了典型的内容更新方法(据说在 VS 15.3 之后不起作用)。还尝试过绝对路径。
csproj
...
<ItemGroup>
<ProjectReference Include="..\B\B.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Update="..\B\appsettings.json" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
<Content Update="..\B\appsettings.*.json" CopyToOutputDirectory="Never" CopyToPublishDirectory="Never" />
</ItemGroup>
...
Run Code Online (Sandbox Code Playgroud)
示例 2:尝试了典型的内容删除方法。还尝试过绝对路径。
csproj
...
<ItemGroup>
<ProjectReference Include="..\B\B.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Remove="..\B\appsettings.json" />
<Content Remove="..\B\appsettings.*.json" />
</ItemGroup>
<ItemGroup>
<None Include="..\B\appsettings.json" …Run Code Online (Sandbox Code Playgroud) visual-studio asp.net-core asp.net-core-6.0 .net-6.0 visual-studio-2022
我和我的团队在高利用率的 .NET Core Web 应用程序上遇到了一些 EF Core/SQL 池问题。
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
当 EF Core/ApplicationDbContext 在托管服务 (QueuedHostedService) 上的后台任务中被引用时,问题开始发生。遵循以下指南:
我遵循了推荐的依赖注入和托管服务指南。
相关线路:
启动文件
...
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
...
services.AddScoped<IScopedWorker, ScopedWorker>();
services.AddSingleton<MySingletonThatAddsToBackground>();
// Follow the host service guide from microsoft.
services.AddHostedService<QueuedHostedService>();
services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
Run Code Online (Sandbox Code Playgroud)
MySingletonThatAddsToBackground.cs
public class MySingletonThatAddsToBackground
{
private readonly IBackgroundTaskQueue _taskQueue;
private readonly …Run Code Online (Sandbox Code Playgroud) entity-framework entity-framework-core .net-core asp.net-core ef-core-3.0
我有一个跨平台的 PWA,但在 iOS 11.3+ 上遇到了一些问题。
当用户执行“添加到主屏幕”时,我想保留菜单栏(刷新、后退、前进按钮)。即我不想要全屏模式,因为我不想创建自己的刷新和返回按钮。
我遵循了https://medium.com/@firt/dont-use-ios-web-app-meta-tag-irresponsively-in-your-progressive-web-apps-85d70f4438cb 上的建议。我发现的大多数其他文章在这个主题上都已经过时了。
我已经删除了“apple-mobile-web-app-capable”元标记,但它不起作用。我也尝试将值设置为“否”。
<meta name="apple-mobile-web-app-capable" content="no">
Run Code Online (Sandbox Code Playgroud)
如何防止 iOS 11 上的“添加到主屏幕”进入全屏模式?