小编Ahm*_*aid的帖子

WCF服务中的错误报告?

我有一个自托管的Net Tcp WCF服务,我有以下方法

        Subscribtion GetSubscribtion(int subscribtionId)
        {
            Subscribtion s;
            if (_subscribtionTable.TryGetValue(subscribtionId, out s) == false)
            {
                Console.WriteLine("Not Found SessionID");//for debugging
                throw new ArgumentException("Invalid Subscription Id");
            }
            return s;
        }
Run Code Online (Sandbox Code Playgroud)

抛出异常是报告服务编程中错误的好方法吗?

c# wcf error-reporting

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

String.StartsWith不能像我期望的那样工作

string word1 = ""; //see example   
string word2 = "";    
bool b1 = word1.StartsWith(word2);
bool b2 = word1.Substring(0, word2.Length) == word2;
Run Code Online (Sandbox Code Playgroud)

对于一些阿拉伯字符串b1不等于b2?你能解释一下这种行为吗?

例:

word1 = ((char)0x0650).ToString()+ ((char)0x0652).ToString()+ ((char)0x064e).ToString();
word2 = ((char)0x0650).ToString()+ ((char)0x0652).ToString();
Run Code Online (Sandbox Code Playgroud)

.net c# string

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

秒表奇怪的行为

            Stopwatch sw = new Stopwatch();
            for (int i = 0; i < lines.Length; i++)
            {
                sw.Start();
                fn(); //call function
                sw.Stop();

            }
            Console.WriteLine(sw.ElapsedMilliseconds);


            long total =0;
            for (int i = 0; i < lines.Length; i++)
            {
                Stopwatch sw = Stopwatch.StartNew();
                fn(); //call function
                sw.Stop();
                total += sw.ElapsedMilliseconds;

            }
            Console.WriteLine(total);
Run Code Online (Sandbox Code Playgroud)

输出不一样,你有什么解释吗?

c# stopwatch

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

在jquery中的请求URL中将localhost更改为我的计算机名称不起作用

我有一个在我的本地机器上工作正常的WCF服务,以及一个从jQuery使用AJAX的客户端,一切都在本地使用url中的localhost工作正常,我试图用我的机器名替换localhost,然后在本地运行,但是请求不起作用并导致js中的calback函数响应错误.

响应没有任何含义信息(readystate = 4,error)

wcf jquery

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

标签 统计

c# ×3

wcf ×2

.net ×1

error-reporting ×1

jquery ×1

stopwatch ×1

string ×1