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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - 拼博之路

使用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>