小编Ogg*_*las的帖子

Sourcetree 2.1.2.5 - 显示"未提交的更改"但尚未处理任何内容

我有一个以前没有经历过的问题.即使我没有任何提交,并试图将我的分支重置为最新的提交Sourcetree显示Uncommitted changes.

在此输入图像描述

根据Atlassian论坛,通常有两个原因:

  1. 您在工作目录中有许多非托管文件,这些文件在SourceTree中列出.这会导致Git/Hg花费相当长的时间浏览所有文件,因此SourceTree会等待Git/Hg报告.- 尝试硬重置,以便应该还原任何更改.如果我编辑一个文件,它将显示在Sourcetree中.
  2. 您的系统规格不是很划清楚.真的,你需要大约20GB的可用磁盘空间,还有一些体面的内存支持你.- 154GB免费硬盘空间.8GB内存免费.

https://community.atlassian.com/t5/SourceTree-questions/quot-Uncommitted-changes-quot-yet-nothing-is-pending/qaq-p/94549

git atlassian-sourcetree

6
推荐指数
1
解决办法
1997
查看次数

.NET Standard 2.0 中的 Microsoft.AspNet.Identity 和 Microsoft.AspNet.Identity.EntityFramework

背景:我们正在开展的项目由多个共享两个库的解决方案组成。一切都写在.NET Framework 4.6.1今天。该项目的目标是采用.NET Core新项目并能够在Docker.

随着新版本的发布.NET Standard 2.1以及.NET Framework 4.8将保留.NET Standard 2.0而不是实施的事实,.NET Standard 2.1感觉是开始的合适时机。微软的 Immo Landwerth 说:

但同样正确的是 .NET Framework 的创新速度必须放慢以减少损坏。从这个意义上说,您通常应该期望大多数新功能只会在 .NET Core(以及派生平台,例如 Xamarin、Mono 和 Unity,因为它们从与 .NET Core 相同的源构建)上可用。

https://blogs.msdn.microsoft.com/dotnet/2018/11/05/annoucing-net-standard-2-1/

我们希望能够访问新项目中的新功能,但不想将每个旧项目都转换为.NET Core. 为了保持.NET Framework.NET Core我们之间的兼容性,我们决定将我们的共享库转换为.NET Standard 2.0.

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

除了以下依赖项之外,这非常有效:

1. System.Net.Http.WebRequestHandler - 已解决

用于像这样的客户端证书:

WebRequestHandler requestHandler = new WebRequestHandler();

//Add certificate if setting exists
if (!string.IsNullOrEmpty(pushEvent?.CertificateThumbprint?.Thumbprint))
{ …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net .net-standard .net-standard-2.0

6
推荐指数
1
解决办法
2286
查看次数

CS0618“SignOutSessionStateManager”已过时:“请改用“NavigateToLogout”。将 Blazor WebAssembly 从 .NET 6 升级到 .NET 7 时

使用个人用户帐户升级 Blazor WebAssembly 时出现以下错误:

错误(活动)CS0618“SignOutSessionStateManager”已过时:“请改用“Microsoft.AspNetCore.Components.Web assembly.Authentication.NavigationManagerExtensions.NavigateToLogout”。

应该如何NavigateToLogout使用?

当前代码:

@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication

@inject NavigationManager Navigation
@inject SignOutSessionStateManager SignOutManager

<AuthorizeView>
    <Authorized>
        <a href="authentication/profile">Hello, @context.User.Identity.Name!</a>
        <button class="nav-link btn btn-link" @onclick="BeginSignOut">Log out</button>
    </Authorized>
    <NotAuthorized>
        <a href="authentication/register">Register</a>
        <a href="authentication/login">Log in</a>
    </NotAuthorized>
</AuthorizeView>

@code{
    private async Task BeginSignOut(MouseEventArgs args)
    {
        await SignOutManager.SetSignOutState();
        Navigation.NavigateTo("authentication/logout");
    }
}
Run Code Online (Sandbox Code Playgroud)

c# blazor blazor-webassembly .net-7.0

6
推荐指数
1
解决办法
2133
查看次数

与Typescript热重新加载IIS网络服务器

我想在使用C#Web Api后端在TypeScript中开发我的React应用程序时使用热重新加载.我使用.Net框架而不是Core,所以我需要使用IIS或IIS Express.我可以使用webpack dev server没有问题的前端热重新加载,但后来我无法访问API资源.我能做到吗?

c# asp.net iis typescript reactjs

5
推荐指数
1
解决办法
1919
查看次数

C# Directory.GetFiles 在不同的计算机上返回不同的结果

我刚刚在我的应用程序中注意到一个非常奇怪的事情。我有一段代码,用于检查文件夹或任何子文件夹是否包含.xls文件而不是.xlsx. 这是因为我使用EPPluswhich 无法处理.xls文件。在运行Windows 10 Home下面代码的计算机上只返回.xls文件而不返回任何.xlsx文件。我现在尝试在一Windows 10 Pro台机器上运行相同的代码,并且代码也获取了.xlsx文件。我知道我只能.xls使用文件,Linq 但我仍然想知道为什么会发生这种情况。

var filePaths = Directory.GetFiles("C:\\xmlfiles", "*.xls", SearchOption.AllDirectories).ToList();

if (filePaths.Count > 0)
{
    var files = string.Join(",", filePaths);
    throw new Exception($"Folder contains .xls files which EPPlus can't handle. Please convert them first. Files: {files}");
}
Run Code Online (Sandbox Code Playgroud)

c# excel epplus

5
推荐指数
1
解决办法
752
查看次数

TypeScript 2.4.1 - > fontWeight - >类型'number'不能赋值为'"inherit"| 400 |

我尝试fontWeight在TypeScript中设置时出现此错误:

Types of property 'test' are incompatible.
    Type '{ fontWeight: number; }' is not assignable to type 'Partial<CSSProperties>'.
        Types of property 'fontWeight' are incompatible.
            Type 'number' is not assignable to type '"inherit" | 400 | "initial" | "unset" | "normal" | "bold" | "bolder" | "lighter" | 100 | 200 | 30...'.
Run Code Online (Sandbox Code Playgroud)

即使400是正确的数字,它也可以是任何数字,因此我得到错误,因为我理解它.我可以将此错误跟踪到React.CSSProperties,它指定fontWeight应该如下所示:

fontWeight?: CSSWideKeyword | "normal" | "bold" | "bolder" | "lighter" | 100 | 200 | 300 | 400 | 500 | …
Run Code Online (Sandbox Code Playgroud)

javascript css typescript material-design material-ui

5
推荐指数
2
解决办法
1880
查看次数

EF Core 2.1.0设置默认字符串长度和列类型

由于Entity Framework将nvarchar(max)字符串默认用作默认值,因此我想将其他内容设置为默认值。

https://dba.stackexchange.com/questions/48408/ef-code-first-uses-nvarcharmax-for-all-strings-will-this-hurt-query-performan

在Entity Framework 6.1.3中,我可以这样修改OnModelCreating(DbModelBuilder modelBuilder)

modelBuilder.Properties<DateTime>().Configure(c => c.HasColumnType("datetime2"));
modelBuilder.Properties<DateTime>().Configure(c => c.HasPrecision(0));

modelBuilder.Properties<string>()
    .Configure(s => s.HasMaxLength(256).HasColumnType("nvarchar"));
Run Code Online (Sandbox Code Playgroud)

如果随后我使用数据注释修改了属性,EF则改用这些值,如下所示:

[MaxLength(128)]
public string Name { get; set; }

[Column(TypeName = "nvarchar(MAX)")]
[MaxLength]
public string Comment { get; set; }
Run Code Online (Sandbox Code Playgroud)

但是使用Microsoft.EntityFrameworkCore.SqlServer 2.1.0我不能做到这一点,我也不能使用Conventions

我可以这样解决,datetime但是如果我尝试对字符串执行相同的操作,则迁移将表明type: "nvarchar(256)", maxLength: 128是否使用例如数据注释。我该如何解决?

foreach (var property in modelBuilder.Model.GetEntityTypes()
    .SelectMany(t => t.GetProperties())
    .Where(p => p.ClrType == typeof(DateTime)))
{
    property.Relational().ColumnType = "datetime2(0)";
}
Run Code Online (Sandbox Code Playgroud)

c# entity-framework entity-framework-core

5
推荐指数
1
解决办法
4100
查看次数

Asp.Net身份从一个应用程序池身份生成密码重置令牌,并在另一个上进行验证

我们有一个面向客户的网站和一个用于创建用户的后台。当在我们的Developer机器上的IIS Express上运行两个应用程序时,使用带有重置密码的欢迎电子邮件创建新用户的过程是完美的。但是,当我们部署应用程序并将应用程序托管在具有不同应用程序池标识的不同IIS服务器上时,它将停止工作。

我们已经能够在同一台服务器上使用不同的应用程序池标识离线复制错误。如果我们进行切换,以使应用程序在IIS中使用相同的应用程序池标识,则一切将再次开始工作。

后台:

applicationDbContext = new ApplicationDbContext();
userManager = new ApplicationUserManager(new ApplicationUserStore(applicationDbContext), applicationDbContext);
var createdUser = userManager.FindByEmail(newUser.Email);
var provider = new DpapiDataProtectionProvider("Application.Project");
userManager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser, int>(provider.Create("ASP.NET Identity"));
var token = userManager.GeneratePasswordResetToken(createdUser.Id);
Run Code Online (Sandbox Code Playgroud)

客户门户:

var applicationDbContext = new ApplicationDbContext();
userManager = new ApplicationUserManager(new ApplicationUserStore(applicationDbContext), applicationDbContext);

var user = await userManager.FindByEmailAsync(model.Email);
if (user == null)
{
    return GetErrorResult(IdentityResult.Failed());
}

var provider = new DpapiDataProtectionProvider("Application.Project");
userManager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser, int>(provider.Create("ASP.NET Identity"));

//This code fails with different Application Pool Identities
if (!await userManager.UserTokenProvider.ValidateAsync("ResetPassword", …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-identity asp.net-identity-2

5
推荐指数
1
解决办法
1425
查看次数

Azure DevOps -&gt; Pipelines -&gt; Library -&gt; Access Azure Key Vault -&gt; Key Vault 不允许从所有网络访问

我们已经通过服务连接(服务主体身份验证)在 Azure DevOps 和 Azure Key Vault 之间建立了连接。但是,为了使其工作,我们需要将Azure Key Vault->Networking标记为 Allow access from: All networks。鉴于我们在这里存储机密,我们希望使用该选项Private endpoint and selected networks而不是Allow trusted Microsoft services to bypass this firewall?set to Yes

像这样:

在此处输入图片说明

但是,这会导致 Azure DevOps -> Pipelines -> Library 上的错误:

指定的 Azure 服务连接需要对所选密钥保管库具有“获取、列出”机密管理权限。单击“授权”以启用 Azure Pipelines 在 Azure 门户中设置这些权限或管理机密权限。

在此处输入图片说明

如果我们All networks为 Azure Key Vault设置 Allow access from:它可以像前面提到的那样工作,但我们希望尽可能避免这种情况。

在此处输入图片说明

在管道中设置 Azure Key Vault 任务

在此处输入图片说明

或者设置一个变量组然后切换回Private endpoint and selected networks导致部署时出现类似的错误。

在此处输入图片说明

MyKey:“客户端地址未授权且调用方不是受信任的服务。\r\n客户端地址:111.222.333.44\r\n调用方:appid= ;oid=00000000-0000-0000-0000-000000000000;iss= https:/ …

azure azure-keyvault azure-devops

5
推荐指数
1
解决办法
1591
查看次数

.NET Core 3.1 HttpClient 间歇性地抛出异常:SocketException: The I/O operation has been aborted because of a thread exit or an

我间歇性地得到以下例外情况:

IOException: 无法从传输连接读取数据:由于线程退出或应用程序请求,I/O 操作已中止。

SocketException: 由于线程退出或应用程序请求,I/O 操作已中止。

系统正在查询外部资源,并且不时发生异常,但似乎没有任何异常。我试图设置更长的超时时间,HttpClient但没有帮助。在异常发生之前,它可能是 5000-50000 次搜索,但我仍然想减轻它。如果我在异常之后直接重试相同的搜索,它会起作用,因此即使我无法访问该应用程序日志,接收方似乎也没有问题。运行.NET Core 3.1

我的服务.cs

public class MyService
{

    private readonly HttpClient _httpClient;

    public MyService(HttpClient client)
    {
        client.BaseAddress = new Uri("https://example.com/");
        client.Timeout = TimeSpan.FromMinutes(5);
        _httpClient = client;
    }
    
    private async Task<List<string>> GetValuesFromSearch(string search)
    {
        //Exception is thrown here
        var response = await _httpClient.GetAsync("search/" + search);

        using var responseStream = await response.Content.ReadAsStreamAsync();
        
        response.EnsureSuccessStatusCode();

        var searchResultList = await JsonSerializer.DeserializeAsync
            <List<string>>(responseStream);

        return searchResultList;
    }
}
Run Code Online (Sandbox Code Playgroud)

像这样调用:

var myService = new MyService(new …
Run Code Online (Sandbox Code Playgroud)

.net c# asynchronous async-await .net-core

5
推荐指数
1
解决办法
4038
查看次数