小编Cod*_*841的帖子

TFS 2012禁用多个签出不起作用

我想为我们的TFS项目禁用多个签出.以下是我期望它的工作方式:

  1. Bob检出File1.cs.
  2. Joe在他的Visual Studio解决方案资源管理器中双击File1.cs并尝试修改它但是看到一条错误消息,说某人已经检出了该文件,因此他无法检查出来.

我已经尝试在Visual Studio中为Bob和Joe设置这样的:

  1. Team-> Team Project Collection Settings-> Source Control ...-> Workspace Settings选项卡中,我将默认工作区类型从"Local(recommended)"更改为"Server".
  2. Team-> Team Project Settings-> Source Control ...-> Check-out Settings选项卡中我更改了Enable multiple check-out to unchecked.
  3. Source Control Explorer-> Workspace Combobox-> Workspaces ...-> Edit ...-> Advanced-> Location我将"Local"更改为"Server".

但是,Bob和Joe仍然可以同时签出同一个文件.是否需要设置其他一些配置选项?

tfs visual-studio-2012 tfs2012

28
推荐指数
1
解决办法
2万
查看次数

如何阻止ASP.NET Core 2.0 MVC缩小修改特定文件?

在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

11
推荐指数
2
解决办法
1282
查看次数

ASP.NET Core 2.1中的数据保护仅适用于一台计算机

我正在使用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 …

c# dpapi asp.net-core

11
推荐指数
2
解决办法
5577
查看次数

AJAX post数据到达ASP.NET Core 2.1控制器时为空

我使用以下 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)

为什么数据传不出去?

c# ajax jquery post asp.net-core

2
推荐指数
1
解决办法
9629
查看次数