小编kar*_*n k的帖子

使用DebugDiag调试转储文件时出错

这是我第一次使用.dmp文件调试或执行任何操作.我正在使用Debugdiag.当我运行我的分析时,我得到这个错误 -

Analysis results may be incomplete because an error occurred while initializing the CLR diagnostic runtime for w3wp.DMP.

Dump File:  w3wp.DMP

Type:  DebugDiag.DotNet.DacNotFoundException

Message:  CLR is loaded in the target, but the correct dac file cannot be found. DacFileName: mscordacwks_Amd64_Amd64_10.0.30319.01.dll. DacLocation: 
Run Code Online (Sandbox Code Playgroud)

它说要解决这个问题,我必须这样做:

To fix this problem, you can copy mscordacwks.dll from the server where the dump was taken and rename it to mscordacwks_Amd64_Amd64_10.0.30319.01.dll and add the path of the folder to the Symbol server path by going to Tools-> …
Run Code Online (Sandbox Code Playgroud)

.net dump debugdiag

11
推荐指数
1
解决办法
4986
查看次数

为什么我突然收到这个错误?

所以我有一个WCF服务,里面有一个Process()方法.此方法从一个表中读取字节数组(文件),并基本上将该文件中的数据放入多个表中.它只是遍历每一行.它在生产环境中工作了一个月以来一直很好.现在突然间,它间歇地抛出这个错误:

System.InvalidOperationException:与当前连接关联的事务已完成但尚未处理.必须先处理事务,然后才能使用连接执行SQL语句.

可能有所帮助的东西:大约2周前,我们更换了生产网络和数据库服务器.我们搬家后,这个错误一直在呕吐.当我们在旧服务器上时,我从未遇到过这个问题.但问题是,这个错误在前9-10天没有发生.现在它突然间歇地发生了.我已经上传了大文件(1k-2.5k行)并且它们工作正常,并且这个错误会引发更小的200行文件!并且服务有时会完美地处理相同的文件.

代码片段:(它更大,但重复类似的操作)

using (var scope = new TransactionScope())
{
    // loop through each row/invoice
    foreach (var row in Rows)
    {
        Invoice invoice = (Invoice)CreateObjectWithConstantData(typeof(Invoice), doc, applicationName);
        invoice = (Invoice)FillObjectWithUserData(invoice, row, -1, -1, string.Empty);
        invoice.InvoiceNumber = InvoiceDBImpl.SaveInvoice(invoice, processFileRequest.RunId);

        if (invoice.InvoiceNumber == Guid.Empty)
        {
            throw new DataAccessException(string.Format(Messages.ErrorSavingInvoice, invoice.ReceiptId, invoice.ProductID));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪之一:

   at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, …
Run Code Online (Sandbox Code Playgroud)

c# sql-server wcf transactions transactionscope

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

给定正整数,我的代码是否有效找出下一个回文?

问题陈述:对于给定的正数,我必须立即找出下一个回文.例如:

For 808, output:818
2133, output:2222
Run Code Online (Sandbox Code Playgroud)

我想知道我的代码是否有效,以及它的效率如何?这是解决问题的好方法吗?

逻辑解释:我已经设置i到数字的最左边位置,j到最右边的位置,我基本上比较了2个数字.我num[j]=num[i]总是分配,并跟踪数字是否大于原始值,或更小或相等.最后,这是:j-i==1 or j==i,根据数字的偶数或奇数的数字,我看看数字是否变大,相应地作出决定.

编辑:这个数字可以达到100,000位数!这是问题陈述的一部分,所以我试图避免强力方法.

int LeftNineIndex = 0, RightNineIndex = 0;
bool NumberLesser = false, NumberGreater = false;
string number = Console.ReadLine();
char[] num = number.ToCharArray();
int i, j, x, y;
for (i = 0, j = num.Length - 1; i <= j; i++, j--)
{
      char m;
      Int32.TryParse(num[i].ToString(),out x);
      Int32.TryParse(num[j].ToString(), out y);
      if (x > y)
      {
           NumberGreater = true;
           NumberLesser = false;
      } …
Run Code Online (Sandbox Code Playgroud)

c# arrays palindrome

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

在空间上拆分字符串变量或在C#中拆分2个空格

我有一个字符串变量,基本上是3个字符串,每个字符串相隔一个空格.这3个字符串的长度可能不同.喜欢

string line="XXX YY ZZ";
Run Code Online (Sandbox Code Playgroud)

现在,偶尔会发生我的字符串变量line,由3个字符串组成,其中第一个和第二个字符串由2个空格分隔,而不是1个.

string line="XX  YY ZZ";
Run Code Online (Sandbox Code Playgroud)

我想要做的是将3个字符串存储在字符串数组中.喜欢:

string[] x其中x[0]="XXX",x[1]="YY",x[2]="ZZ"

我试图使用Split功能.

string[] allId = line.Split(' ');
Run Code Online (Sandbox Code Playgroud)

它适用于第一种情况,而不适用于第二种情况.有没有任何简洁明了的方法呢?

c# string

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

什么是字节码?

字节代码是汇编代码和机器代码之间的代码的中间形式吗?字节码和目标代码一样吗?

这就是我的想法 - 高级语言 - >汇编语言 - >机器代码/目标代码(0s和1s.不同的CPU不同)

是这样的吗?高级语言 - >汇编语言 - >字节代码(将由虚拟机处理,将其转换为机器代码) - >机器代码

我已经读过这个 - 字节码与汇编语言代码,但需要更好地理解它

assembly programming-languages bytecode

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

System.IO.File.Exists(fpath)在Chrome和Firefox中返回false

我有以下代码在Internet Explorer中有效,但在Firefox和Google Chrome中无效.

public ActionResult LogoForm(HttpPostedFileBase file)
{
    if (file != null)
    {
        string fpath = file.FileName;
        if (System.IO.File.Exists(fpath))
        {
            // Logic comes here
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的视图中我有这个:

@using (Html.BeginForm("LogoForm", "LogoEditor", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <text>Logo Image &nbsp;&nbsp;&nbsp;</text>
    <input type="file" name="file" id="file" /> <text> &nbsp; &nbsp; &nbsp;</text>
    <input type="submit" name="upload" value="Upload" />
}
Run Code Online (Sandbox Code Playgroud)

如果Firefox和Chrome中有任何文件,则行'if(System.IO.File.Exists(fpath))'始终返回false!它找不到该文件.为什么这样?

c# asp.net-mvc-3

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

我的C#Reg-ex是否正确?

如果我必须匹配一个至少7个字符长,不超过20个字符,至少有1个数字,至少1个字母的字符串,这个正则表达式是否正确?它没有其他限制.

[0-9]+[A-Za-z]+{7,20}
Run Code Online (Sandbox Code Playgroud)

谢谢

c# regex

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

我应该在查询中检查null或dbnull

我有一个查询,检查使用的特定类型的记录数count().

select count(*) from abc where date="some value"
Run Code Online (Sandbox Code Playgroud)

在这里,我的查询可能会返回nullDBNull?我应该检查一下吗?

c# sql-server-2008

0
推荐指数
1
解决办法
1118
查看次数