惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
Spread Privacy
Spread Privacy
I
InfoQ
V
V2EX
S
Schneier on Security
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
S
SegmentFault 最新的问题
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Latest news
Latest news
S
Secure Thoughts
Project Zero
Project Zero
MongoDB | Blog
MongoDB | Blog
I
Intezer
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
N
Netflix TechBlog - Medium
V2EX - 技术
V2EX - 技术
量子位
T
Threatpost
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
T
Tor Project blog
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog
博客园 - Franky
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
L
LINUX DO - 热门话题

博客园 - 拼博之路

使用FreeSql时,Set JsonMap列时需要注意的事项 近日,网站 CDN 流量受到来自电信[山东烟台]、[江苏扬州]、[湖南岳阳]家庭宽带的攻击 宝塔 nginx 负载均衡配置 vs2022 编译报错System.InvalidOperationException: No file exists for the asset at either location 如何在 Nuxt3 中更改生产环境端口 .Net Core 页面Tag Helpers不提示,颜色也没有变化 net core中使用jwt时,提示DenyAnonymousAuthorizationRequirement: Requires an authenticated user 在Vue3中,集成VueQuill Rich Text Editor for Vue 3 [Qt] vs 2022写qt解决"常量中有换行符"编译报错问题! MySQL导入SQL文件过大或连接超时的解决办法 windows10 命令行 重置文件夹权限 .Net Core WebAPI 序列化时忽略空值字段 .net mvc中禁用客户端验证 c#8.0+ 运算符 windows11 升级到10.0.22598.200时安装到35%提示硬件尚未准备好 浏览器提示:你的连接不是专用连接的解决方法 HttpWebRequest 基础连接已经关闭: 连接被意外关闭 .NET Core应用程序每次启动后使用string.GetHashCode()方法获取到的哈希值(hash)不相同 elasticsearch 按分类ID查询
解决 ASP.NET Core 部署到 IIS,更新项目时"文件夹正在使用"错误
拼博之路 · 2022-04-19 · via 博客园 - 拼博之路

此解决方法来源于微软官方

原文地址:https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-6-preview-3/#shadow-copying-in-iis

项目在发布的时候,根目录会产生一个web.config文件,修改此文件为

原文如下

我们在 IIS ASP.NET 核心模块中添加了一项新功能,以添加对卷影复制应用程序程序集的支持。目前,.NET 在 Windows 上运行时会锁定应用程序二进制文件,因此当应用程序仍在运行时,无法替换二进制文件。虽然我们的建议仍然是使用应用脱机文件,但我们认识到在某些情况下(例如 FTP 部署)无法执行此操作。

在这种情况下,可以通过自定义 ASP.NET 核心模块处理程序设置来启用卷影复制。在大多数情况下,ASP.NET 核心应用程序没有签入到源代码管理中的 web.config,您可以对其进行修改(它们通常由 SDK 生成)。可以添加此示例以开始使用。web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->

  <system.webServer>
    <handlers>
      <remove name="aspNetCore"/>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModulev2" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
      <handlerSettings>
        <handlerSetting name="experimentalEnableShadowCopy" value="true" />
        <handlerSetting name="shadowCopyDirectory" value="../ShadowCopyDirectory/" />
        <!-- Only enable handler logging if you encounter issues-->
        <!--<handlerSetting name="debugFile" value=".\logs\aspnetcore-debug.log" />-->
        <!--<handlerSetting name="debugLevel" value="FILE,TRACE" />-->
      </handlerSettings>
    </aspNetCore>
  </system.webServer>
</configuration>

注意:processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" 要更改为
processPath="dotnet" arguments=".\GamePlayer.Web.dll"

GamePlayer.Web.dll 为你项目的DLL名称

../ShadowCopyDirectory/ 也可以更改为你自己存放副本的目录

否则会报错

已测试,好用

.net 7 中有改动

 https://weblog.west-wind.com/posts/2022/Nov/07/Avoid-WebDeploy-Locking-Errors-to-IIS-with-Shadow-Copy-for-ASPNET-Core-Apps

<aspNetCore processPath=".\Westwind.Webstore.Web.exe" 
            hostingModel="inprocess"
            stdoutLogEnabled="false" 
            stdoutLogFile=".\logs\stdout" >

 <handlerSettings>
   <handlerSetting name="enableShadowCopy" value="true" />
   <handlerSetting name="shadowCopyDirectory"       
                   value="../ShadowCopyDirectory/" />
 </handlerSettings>
 
</aspNetCore>