小编Jac*_*ack的帖子

面向 4.7.2 的 Asp.net 网站项目无法使用 MSBuild 解析 .netstandard 2.0 引用

我有一个 .net 4.0 asp.net 网站(旧网站,没有 .csproj)。这引用了 .net framework 4.0 类库(共享库 A)。

我在解决方案中添加了一个新的 .net 核心 API 项目。该项目还需要与共享库 A 对话。

解决方案(我认为)是将类库移动到 .net 标准 2.0,然后将网站移动到 4.7.2,这将允许它引用 .net 标准 2.0 项目。

为此,我更改了网站的网络配置,以便:

 <compilation debug="true" targetFramework="4.7.2">
 <httpRuntime maxRequestLength="10000" executionTimeout="1000" requestValidationMode="2.0" targetFramework="4.7.2"/>
Run Code Online (Sandbox Code Playgroud)

这一切都适用于 Visual Studio。解决方案构建、网站运行以及 .netstandard2.0 库中的代码按预期运行并且可调试。我知道 Visual Studio 做一些与 MSBuild.exe 不同的事情。

问题是我们的 CI 服务器无法构建解决方案,本地的“MSBuild.exe”也无法构建。

我正在运行的命令是:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" "[Path to Solution]\AT3.sln"
Run Code Online (Sandbox Code Playgroud)

然后我得到错误:

 warning MSB3268: The primary reference "C:\Work\AT3\at3\wrld\AT3.Common.Utilit ies\bin\Debug\netstandard2.0\AT3.Application.Utilities.dll" could not be resolved because it has an indirect depende ncy on the framework …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net msbuild .net-core

8
推荐指数
1
解决办法
1263
查看次数

Thread.Sleep在Asp.net vNext中

我需要调用一个JSON api,它只允许每秒有限数量的请求,以确保不会从特定的IP发生DDOS.请求需要多长时间并不重要,因为这将在一夜之间作为自动化过程完成,但是我需要在每个请求之间暂停某些方式以确保我的IP不会暂时列入黑名单.

现在我要完成Thread.Sleep(1000)以确保只发送一个请求,但在asp.net vNext Thread.Sleep不起作用/存在所以我不能这样做.

有没有其他或更好的方法来处理我需要做的事情?没有批量API,因此必须一次完成1个请求.

提前致谢.

c# asp.net asp.net-mvc multithreading asp.net-core-mvc

3
推荐指数
1
解决办法
3602
查看次数