小编Dej*_*lar的帖子

具有当前 URL 信息的 Blazor 全局异常处理程序

我想在 Blazor 服务器应用程序中发生未处理的异常时记录浏览器中设置的 URL 。

我使用 Serilog 进行日志记录,还使用请求日志记录中间件。

builder.Host.UseSerilog();
app.UseSerilogRequestLogging;
Run Code Online (Sandbox Code Playgroud)

但这还不够,因为只有一个 HTTP 请求,然后 Blazor SignalR 连接就会打开。因此,Serilog 不知道 Blazor 设置的浏览器中的实际路径,并且始终返回/_blazor,这是有道理的。

我不想将所有函数包装在try - catch块中来记录异常。Blazor 类型还处理异常并设置blazor-error-ui元素的 CSS。

为了尝试重现错误,我需要异常发生时在浏览器中设置的 URL。有没有办法捕获全局异常并以某种方式获取浏览器中设置的 URL?也许可以访问该NavigationManager对象?

c# blazor .net-6.0

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

在PowerShell中连接到CRM 2016 IFD

我想使用Get-CrmConnectionSDK中包含的PowerShell cmdlet连接到CRM 2016服务器.

我找不到正确的连接字符串.

连接到本地网络中的服务器正常工作:

Get-CrmConnection -ConnectionString "Url=http://<server>/OrganizationName;"
Run Code Online (Sandbox Code Playgroud)

但是连接到为IFD配置的服务器失败:

Get-CrmConnection -ConnectionString "Url=https://crm.ourdomain.com/"

Get-CrmConnection : Organization cannot be null or empty.
Parameter name: Organization Name
At line:1 char:1
+ Get-CrmConnection -ConnectionString "Url=https://crm.ourdomain.com/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SyntaxError: (:) [Get-CrmConnection], ArgumentNullException
    + FullyQualifiedErrorId : -9,Microsoft.Xrm.Tooling.CrmConnector.Powershell.Commands.GetCrmConnectionCommand
Run Code Online (Sandbox Code Playgroud)

我尝试在连接字符串中添加AuthType参数,提供组织名称,但没有成功.重要的是我可以使用交互模式连接:

Get-CrmConnection -InteractiveMode
Run Code Online (Sandbox Code Playgroud)

交互模式窗口

这将返回以下连接:

IsReady                        : True
IsBatchOperationsAvailable     : True
Authority                      :
OAuthUserId                    :
ActiveAuthenticationType       : AD
OrganizationServiceProxy       : Microsoft.Xrm.Tooling.Connector.CrmWebSvc+ManagedTokenOrganizationServiceProxy
OrganizationWebProxyClient     :
LastCrmError                   : OrganizationWebProxyClient is null
LastCrmException               :
CrmConnectOrgUriActual         : https://crm.ourdomain.com/XRMServices/2011/Organization.svc
ConnectedOrgFriendlyName …
Run Code Online (Sandbox Code Playgroud)

powershell crm dynamics-crm

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

标签 统计

.net-6.0 ×1

blazor ×1

c# ×1

crm ×1

dynamics-crm ×1

powershell ×1