解决 IIS 下部署 react 单页应用,刷新浏览器后出现404问题。
解决方案如下
1. 安装 IIS URL Rewrite 模块。
2 iis 设置index.html 为默认页面
3 web.config 文件中增加 以下配置。
"1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
conditions>
<action type="Rewrite" url="/" />
rule>
rules>
rewrite>
system.webServer>
configuration>
解决无法安装identityserver4 模板项目的办法就是指定版本号
dotnet new --install IdentityServer4.Templates::4.0.1
IIS / asp.net mvc /asp.net core 跨域的各种方法。
C# 中有lock关键字来实现共享资源的锁定,读写锁则有:ReaderWriteerLock, 只读成员则可通过 static readonly 来创建,该种方法还可以用于实现线程安全的单利模式,
当然 C# 中也有ThreadLocal 类,用于实现线程间数据隔离,线程安全集合则有: CocurrentBag、ConcurrentDictionary等等。
另外分布式环境下:zookeeper也是可以和C#一起使用来实现分布式锁的,有相应的zookeeper C#客户端库。