C# System.Exception._COMPlusExceptionCode 在 transactionScope 内运行时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10191710/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 12:48:25  来源:igfitidea点击:

System.Exception._COMPlusExceptionCode when running within transactionScope

c#asp.netado.net

提问by Elad Benda

I'm trying to call a DB sp I wrote

我正在尝试调用我写的 DB sp

from within c# transactionScope

从 c# transactionScope 中

public static void RunInTransaction(Action logic)
{
    var options = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted };
    using (var transaction = new TransactionScope(TransactionScopeOption.RequiresNew, options))
    {
        logic();
        transaction.Complete();
    }
}

where logicis actually calling the spfrom c#.

logic实际上在哪里调用spfrom c#

And I get the following error:

我收到以下错误:

System.Exception._COMPlusExceptionCode

System.Exception._COMPlusExceptionCode

采纳答案by ruspava

Seems weird but might be related: If you have the following piece of code:

看起来很奇怪,但可能是相关的:如果您有以下代码:

private static readonly RegexPattern = "...";

and that pattern is invalid(mine was missing a parenthesis), then you generate COMPlusExceptionCode-exceptions when the containing class if initially loaded. (I managed this and I'm not even touching a database)

并且该模式无效(我的缺少括号),然后COMPlusExceptionCode在最初加载包含类时生成-exceptions 。(我管理了这个,我什至没有接触数据库)

回答by erdal tosun

Sql Servis kapal?. bilgisayar hizmetler b?lümünde Sql service > start etmelisiniz

Sql 服务 kapal?。bilgisayar hizmetler b?lümünde Sql 服务 > 启动 etmelisiniz

google translate:Sql service is off. Sql service> in the computer services section should start

谷歌翻译:Sql 服务已关闭。Sql service> 在计算机服务部分应该启动