我有一个自托管的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)
抛出异常是报告服务编程中错误的好方法吗?
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) 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)
输出不一样,你有什么解释吗?
我有一个在我的本地机器上工作正常的WCF服务,以及一个从jQuery使用AJAX的客户端,一切都在本地使用url中的localhost工作正常,我试图用我的机器名替换localhost,然后在本地运行,但是请求不起作用并导致js中的calback函数响应错误.
响应没有任何含义信息(readystate = 4,error)