我想为我们的TFS项目禁用多个签出.以下是我期望它的工作方式:
我已经尝试在Visual Studio中为Bob和Joe设置这样的:
但是,Bob和Joe仍然可以同时签出同一个文件.是否需要设置其他一些配置选项?
我在ASP.NET Core 2.0 MVC中执行Bundling和Minification,但是当它不应该发生缩小时我遇到了一个问题.在我的页面中,我有以下脚本标记:
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT"
crossorigin="anonymous"
asp-fallback-test="window.jQuery"
asp-fallback-src="~/js/jquery.min.js">
</script>
Run Code Online (Sandbox Code Playgroud)
在我的bundleconfig.json中,我有以下部分:
{
"outputFileName": "wwwroot/js/jquery.min.js",
"inputFiles": [
"node_modules/jquery/dist/jquery.min.js"
],
"minify": {
"enabled": false
}
}
Run Code Online (Sandbox Code Playgroud)
问题是〜/ js/jquery.min.js文件在通过此捆绑/缩小过程转换时丢失其尾随换行符,这使得文件的预期散列不再匹配.作为一种解决方法,我可以为完整性值指定2个哈希,以支持包含或不包含换行符的文件,如下所示:
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT sha384-I7/UTpkJas2maMjJpGmrvEgQecqO8Dta/9Wwh+cQrH6Jj984WRRFhWg4MV/oTkIW"
Run Code Online (Sandbox Code Playgroud)
但这不仅仅是确保缩小不会触及此文件.如何阻止这条新线被修剪?
javascript visual-studio bundling-and-minification asp.net-core asp.net-core-2.0
我正在使用ASP.NET核心数据保护系统使用应用程序A加密数据并使用应用程序B对其进行解密.
加密和解密在开发机器上运行时都有效,但是当应用程序B移动到生产机器时,它不再能够解密,因为IDataProtector.Unprotect方法会抛出异常:
System.InvalidOperationException:密钥环不包含有效的默认保护密钥.数据保护系统无法创建新密钥,因为禁用了密钥的自动生成.
这是我用于在应用程序B中配置解密的代码:
sKeysPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Keys");
services.AddDataProtection()
.SetApplicationName("My Application") // Application A sets this same name
.PersistKeysToFileSystem(new DirectoryInfo(sKeysPath))
.ProtectKeysWithCertificate("634D3F23...")
//.ProtectKeysWithCertificate(x509Certificate2) // I've tried using an X509 certificate parameter but it gives the same result as providing the thumbprint of the one in the certificate store
.DisableAutomaticKeyGeneration(); // Application A is the master key generator so do not generate keys
Run Code Online (Sandbox Code Playgroud)
生产计算机确实包含相同的Keys文件夹(包含.pfx和.xml文件)以及Windows证书库中安装的相同密钥.
据我了解,通过将证书文件提供给Data Protection系统,它应该可以在任何计算机上运行,而不是绑定到特定计算机或Windows用户.这个假设是不正确的还是我正在执行解密的方式有问题?
以下是一些更详细的日志消息:
2018-06-13 16:32:32.6750 | TRACE | Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector | 5 | Performing unprotect …
我使用以下 jQuery 代码将数据发布到 ASP.NET Core MVC 2.1.2 页面:
function OnCountryChange() {
$.ajax({
url: "/OnCountryChange",
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
headers: {
"RequestVerificationToken": $('input[name = __RequestVerificationToken]').val()
},
data: JSON.stringify({
sCountryCode: "Test 123"
})
});
}
Run Code Online (Sandbox Code Playgroud)
我用这种方法在控制器中收到帖子:
[HttpPost]
[ValidateAntiForgeryToken]
[Route("/OnCountryChange")]
public IActionResult OnCountryChange([FromBody] string sCountryCode)
{
logger.LogDebug($"Country code is: {sCountryCode ?? "null"}");
return Json(sCountryCode);
}
Run Code Online (Sandbox Code Playgroud)
打印到日志的输出是:
国家/地区代码为:空
原始请求正文(使用 Fiddler 查看)如下所示:
{"sCountryCode":"Test 123"}
Run Code Online (Sandbox Code Playgroud)
为什么数据传不出去?