问题标签 [enterprise-library-6]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
237 浏览

enterprise-library-6 - 企业库 6.0 迁移

在我们的项目中,我们使用 Enterprise library 5.0 进行异常处理。现在,我们计划使用 Enterprise library 6.0,但我们面临 EnterpriseLibraryContainer.Current 在 Enterprise library 6.0 中不可用的问题。

我发现这个链接 Fluent API 只生效一次(企业库) ,它提到了用于 6.0 的 LogWriter 迁移。我想为 ExceptionHandling 做同样的事情。下面是与我们的项目类似的示例代码。

EHConfigMgr.cs

Proxybase.cs

请帮助我在不影响现有功能的情况下更改代理库。

0 投票
1 回答
968 浏览

logging - 将 Enterprise Library 6.0.x 与 Visual Studio 2015 一起使用,无需安装 .exe 文件

我需要使用“Enterprise Library 6.0.x”来使用 Visual Studio 2015 进行日志记录。在此之前,我使用过 Log4Net,并且我知道如何使用 log4net 编写日志文件。但我是第一次使用“企业库”。

我已经为 Visual Studio 2015 Enterprise 安装了 Nuget 包“EnterpriseLibrary.Logging”版本 6.0.1304。现在我正在寻找一个向导工具,我可以从中配置它以进行日志记录。

我浏览了一些博客文章,他们建议执行一些写在“install.ps1”文件中的 powerShell 脚本,但由于某些管理员权限问题而失败,因为我在系统上没有管理员权限。

我也访问了以下链接,但没有帮助我:

带有 Visual Studio 2015 的 Enterprise Library 6.0 配置控制台不包含自动缩放设置

Visual Studio 2015 的企业库配置编辑器在哪里?

安装 Visual Studio 2015 Enterprise 时写入文件时出错

请建议一些解决方案或链接以获得良好的文档,以便在 Visual Studio 2015 中使用 Enterprise Library 6.0.x,而无需安装需要管理员权限的 .exe 文件。

0 投票
0 回答
182 浏览

c# - 避免记录相同的异常

我正在使用 Microsoft.Practices.EnterpriseLibrary.ExceptionHandling 来处理应用程序中的异常。

我有一个在我们的自定义日志记录类中记录异常的处理程序。此处理程序是具有 NotifyRethrow 作为 PostHandlingAction 的异常策略定义的一部分。

这是记录异常的处理程序

这是我的例外政策定义

我想避免使用此处理程序两次记录相同的异常。这可能与 ExceptionHandling 应用程序块。

假设我们有一个 MethodA 调用 MethodB 反过来抛出一个异常。

这个例子是合法的。可以从其他上下文而不是从 MethodA 调用 MethodB。恰好在这种情况下,它是从 MethodA 调用的,并且该方法本身具有异常处理块。如您所见,这将记录我的异常两次。

我想出的唯一解决方案是在 ExceptionLoggingHandler 中收集抛出的异常,以跟踪记录的异常。这样我只会记录一次异常。此解决方案的问题是我不知道何时删除异常。

0 投票
1 回答
2461 浏览

c# - 将 EnterpriseLibrary v5 迁移到 v6 和 .Net 框架 3.5 到 4.6.2

需要将我们的 ASP.Net 应用程序(3.5 框架)迁移到 .Net 框架 4.6.2。使用了 EnterpriseLibrary v5,我们正在迁移的 ASP.Net 项目(4.6.2 框架)中使用 Nuget 管理器迁移/替换到 EL v6。

我在运行时面临 EL v6 dll 的问题。艰难,我已经从 Nuget 管理器中添加了所有必需的 dll,我收到错误消息说 dll 不可用。

错误 :

无法从程序集“Microsoft.Practices.EnterpriseLibrary.Common,版本=6.0.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35”加载类型“Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer”。

这是我在解决方案中加载的 EL 版本 -

  • Microsoft.Practices.EnterpriseLibrary.Common:v6.0.1304
  • Microsoft.Practices.EnterpriseLibrary.Data:v6.0.1304
  • Microsoft.Practices.EnterpriseLibrary.ExceptionHandling:v6.0.1304
  • Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging:v6.0.1304
  • Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF:v6.0.1304
  • Microsoft.Practices.ServiceLocation : : v1.0.0
  • Microsoft.Practices.Unity.Configuration:v4.0.1
  • Microsoft.Practices.Unity:v4.0.1
  • Microsoft.Practices.Unity.Interception.Configuration:v4.0.1
  • Microsoft.Practices.Unity.Interception:v4.0.1

请指教,我该如何解决所有这些问题..

0 投票
0 回答
69 浏览

enterprise-library-6 - 每次使用 Enterprise Library Logging 写入时清空日志文件

我的项目中使用了 Enterprise Library Logging,它运行良好,但我只需要随时保存最后一个条目。有什么配置吗?

下面是我目前的配置。

0 投票
1 回答
78 浏览

.net - 在 Microsoft Enterprise Framework 中,FormatterData.GetRegistrations 方法去了哪里?

我有一项不幸的任务是升级使用该Microsoft.Practices.EnterpriseLibrary.Logging库的已有十年历史的 C# 代码。我几乎可以编译它,只剩下一个错误:

他们正在扩展 FormatterData 抽象类,该类由Microsoft.Practices.EnterpriseLibrary.Logging.Configuration. MSDN 包括此类的(最小)文档。这包括所谓的方法GetDetails。代码覆盖此方法。但是,我的库副本没有这种方法。我已经下载了该库的最新副本(版本标签:“6.0.0.0”)。我没有原始作者正在使用的 dll 的副本。

我只能假设该方法已被删除,并且我可能需要下载该库的一些历史副本。但是,MSDN 文章(据我所知)并未指出这些方法是在何处添加或删除的。我需要使用哪个版本的库,在哪里可以找到它?

0 投票
0 回答
310 浏览

.net - 分析高 CPU 使用率的内存转储显示对 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher 的调用

我正在分析高 CPU 使用率的内存转储,但我所看到的只是大多数失控线程显示 0 天 0:05:48.921 秒和毫秒变化的恒定时间,并且大多数都调用 Microsoft Practices EnterpriseLibrary ConfigurationChangeWatcher。我们正在使用 MS Ent Lib 6 进行日志记录。我不明白这一切与高 CPU 使用率有什么关系,谁能帮我分析转储并抛出一些线索。

Child SP IP Call Site 000000581c2ddeb0 00007ffb58790b2a [GCFrame: 000000581c2ddeb0] 000000581c2ddf80 00007ffb58790b2a [GCFrame: 000000581c2ddf80] 000000581c2ddfb8 00007ffb58790b2a [HelperMethodFrame: 000000581c2ddfb8] System.Threading.Monitor.Enter(System.Object) 000000581c2de0b0 00007ffaf0046f8a System.Threading.TimerQueueTimer.Change(UInt32, UInt32) 000000581c2de120 00007ffaf0ab0047 System.Timers.Timer.set_Enabled(Boolean) 000000581c2de180 00007ffaf1bf3edb Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher.pollTimer_Elapsed(System.Object, System.Timers.ElapsedEventArgs) 000000581c2de1d0 00007ffaf1bf3ea1 Microsoft.Practices.EnterpriseLibrary. Common.Configuration.Storage.ConfigurationChangeWatcher.pollTimer_Elapsed(System.Object, System.Timers.ElapsedEventArgs) 000000581c2de220 00007ffaf1bf395f System.Timers.Timer.MyTimerCallback(System.Object) 000000581c2de2a0 00007ffaf049e7b2 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 000000581c2de370 00007ffaf049cb67 System.Threading. ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 000000581c2de3a0 00007ffaf0a13c69 System.Threading.TimerQueueTimer.CallCallback() 000000581c2de400 00007ffaf0a1390a System.Threading.TimerQueueTimer.Fire() 000000581c2de450 00007ffaf0a1c079 System.Threading. QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 000000581c2de4b0 00007ffaf0a19c48 System.Threading.ThreadPoolWorkQueue。Dispatch() 000000581c2de928 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581c2de928] 000000581c2deab8 00007ffb4f3f4073 [ContextTransitionFrame: 000000581c2deab8] 000000581c2decd8 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581c2decd8]

Child SP IP Call Site 000000581b73e1e8 00007ffb5879195a [InlinedCallFrame: 000000581b73e1e8] Microsoft.Win32.Win32Native.GetFileAttributesEx(System.String, Int32, WIN32_FILE_ATTRIBUTE_DATA ByRef) 000000581b73e1e8 00007ffaefe84a3a [InlinedCallFrame: 000000581b73e1e8] Microsoft.Win32.Win32Native.GetFileAttributesEx(System.String, Int32, WIN32_FILE_ATTRIBUTE_DATA ByRef) 000000581b73e1c0 00007ffaefe84a3a DomainNeutralILStubClass.IL_STUB_PInvoke(System.String, Int32, WIN32_FILE_ATTRIBUTE_DATA ByRef) 000000581b73e280 00007ffaefe83d92 System.IO.File.FillAttributeInfo(System.String, WIN32_FILE_ATTRIBUTE_DATA ByRef, Boolean, Boolean) 000000581b73e2f0 00007ffaefe83bc7 System.IO.File.InternalExists(System .String) 000000581b73e350 00007ffaefe81544 System.IO.File.InternalExistsHelper(System.String,Boolean) 000000581b73e390 00007ffaf0aafe51 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeFileWatcher.GetCurrentLastWriteTime() 000000581b73e3c0 00007ffaf1bf3e18 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Storage.ConfigurationChangeWatcher.pollTimer_Elapsed(System.Object, System.Timers.ElapsedEventArgs) 000000581b73e410 00007ffaf1bf395f System.Timers.Timer.MyTimerCallback(System.Object) 000000581b73e490 00007ffaf049e7b2 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 000000581b73e49.b67System.Threading.ExecutionContext. (System.Threading.ExecutionContext、System.Threading.ContextCallback、System.Object、布尔值)000000581b73e590 00007ffaf0a13c69 System.Threading.TimerQueueTimer。CallCallback() 000000581b73e5f0 00007ffaf0a1390a System.Threading.TimerQueueTimer.Fire() 000000581b73e640 00007ffaf0a1c079 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 000000581b73e6a0 00007ffaf0a19c48 System.Threading.ThreadPoolWorkQueue.Dispatch() 000000581b73eb18 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eb18] 000000581b73eca8 00007ffb4f3f4073 [ContextTransitionFrame: 000000581b73eca8] 000000581b73eec8 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eec8]Dispatch() 000000581b73eb18 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eb18] 000000581b73eca8 00007ffb4f3f4073 [ContextTransitionFrame: 000000581b73eca8] 000000581b73eec8 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eec8]Dispatch() 000000581b73eb18 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eb18] 000000581b73eca8 00007ffb4f3f4073 [ContextTransitionFrame: 000000581b73eca8] 000000581b73eec8 00007ffb4f3f4073 [DebuggerU2MCatchHandlerFrame: 000000581b73eec8]

我通过调用堆栈看到了这种模式。

0 投票
1 回答
370 浏览

c# - oracle存储过程抛出参数不匹配错误

我正在尝试在 C# 中使用 Microsoft.Practices.EnterpriseLibrary 6 调用 Oracle 存储过程

下面是我的存储过程

下面的代码用于调用此过程

我在运行时遇到错误

有没有人遇到过这个错误??有没有可以修复的??我尝试了不同的实现方式,但无法找到解决方案

0 投票
1 回答
1423 浏览

asp.net-core-2.0 - ASP.NET Core 2.0 配置绑定

我正在使用 Visual Studio 2017 版本 15.7.2 并使用以下链接中的答案:

net core 1 (dnx 4.5.1) with enterpriselibrary 6 - 设置连接字符串

我无法上班的部分是:

configuration.Get<DataConfiguration>()返回 DataConfiguration 的空实例。我希望它在 appsettings 文件中填充或绑定到 DataConfiguration。

我的 appsettings.json:

我的启动.cs

我错过了什么?

0 投票
1 回答
3658 浏览

asp.net-core - IBM DB2 Core:ASP.NET Core 2.1 和 Microsoft Enterprise Libraries 的连接字符串

我将这个Microsoft.EnterpriseLibrary 端口用于 .Net Core。它需要一个配置文件app.config,其中指定了连接字符串。我尝试使用我在另一个工作项目中使用的相同连接字符串,但它在这里不起作用。

如何为 ASP.NET Core 2.1 指定 DB2 连接字符串?

我这是我尝试过的:

但是当我执行这个时:

它向我抛出了这个异常:

我认为提供者名称不正确,但我在网上找不到任何工作示例。