从IIS获取ERR_CONNECTION_RESET,日志中没有信息(Getting ERR_CONNECTION_RESET from IIS with no information in logs)
当我的ASP.NET服务器尝试回复错误时,我在Chrome中获得了
ERR_CONNECTION_RESET
。通常我可以通过查看日志文件找到有关服务器错误的信息,但那里什么都没有。
在响应中运行调试器似乎表明一切正常,但最后,Chrome告诉我连接已重置。
以下是处理异常处理的代码:
try { ... } catch (ArgumentException e) { Response.StatusCode = 400; Response.StatusDescription = e.Message; return new ContentResult {Content = "" }; }
Chrome在控制台中显示
net::ERR_CONNECTION_RESET
。使用Fiddler,我收到错误消息
[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
如果我在IIS中启用失败的请求跟踪 ,并打开生成的xml文件
GENERAL_FLUSH_RESPONSE_END BytesSent 0 ErrorCode The parameter is incorrect. (0x80070057)
我花了好几个小时试图调试这个没有太多运气。
I am getting a
ERR_CONNECTION_RESET
in Chrome when my ASP.NET server is trying to reply with an error.Usually I can find information about server errors by looking in the log files, but there is nothing there.
Running a debugger over the reponse seems to show everything is OK, except at the end, Chrome tells me the connection was reset.
Here is the code that is handling the exception handling:
try { ... } catch (ArgumentException e) { Response.StatusCode = 400; Response.StatusDescription = e.Message; return new ContentResult {Content = "" }; }
Chrome shows me
net::ERR_CONNECTION_RESET
in the console.Using Fiddler, I get the error message
[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
If I Enable Failed Request Tracing in IIS, and open the generated xml file
GENERAL_FLUSH_RESPONSE_END BytesSent 0 ErrorCode The parameter is incorrect. (0x80070057)
I have spent hours trying to debug this without much luck.
原文:https://stackoverflow.com/questions/39503011
最满意答案
“最佳”取决于您拥有的资源。
这是我要做的:
- 为每个单词长度存储单独的字典。
- 我假设您的搜索不区分大小写! 如果字符
a..z
出现在字中,则为每个字存储32位值,其中设置位0到25。 将单词存储在Map<Integer, List<String>>
(键是32位值,value是此键的所有单词的列表)如何搜索:
- 拿着想要长度的字典
- 为您的模式创建32位值。
迭代
Map
所有键,并检查键的按位和模式的32位值是否等于模式的32位值。 如果不是这不能匹配。 如果通过此检查,则仅仅匹配是不够的,因为它不处理字符的顺序或者如果出现多于1的字符。 但检查速度非常快,不需要查看单词的每个字符。迭代
Map
的列表,并通过将列表中每个单词的字符与模式进行比较来检查它们与模式的真实匹配。示例:三字母单词的字典:the,cat,bag,nor,ega,atc,ron;
-> Hashvalues 00000000000010000000000010010000 the 00000000000010000000000000000101 cat, atc 00000000000000000000000001000011 bag 00000000000000100110000000000000 nor, ron 00000000000000000000000001010001 age, ega Value for pattern _a_ is 00000000000000000000000000000001 Step 3 returns that the keys 00000000000010000000000000000101, 00000000000000000000000001000011 and 00000000000000000000000001010001 are candidates for matches. Step 4 returns: 'cat' and 'bag'
'Best' depends on the resources you have.
Here is what I would do:
- Store a separate dictionary for each word length.
- I assume your search is not case sensitive! Store for each word a 32-bit value in which the bits 0 to 25 are set if the character
a..z
occurs in the word. Store the words in aMap<Integer, List<String>>
(key is the 32-bit value, value is a list of all words for this key)How to search:
- Take the dictionary with the words of the wanted length
- Create the 32-bit value for your pattern.
Iterate all keys of the
Map
and check if the key bitwise and with the 32-bit value for your pattern is equal to the 32-bit value for your pattern. If not this cannot be matches. If this check is passed, it is not sufficient to be a match, because it does not handle order of characters or if the occur more than ones. But the check is very fast and does not need to look at each character of the words.Iterate the list in the
Map
and check them which are real matches for your pattern by comparing the characters of each word in the list with your pattern.Example: Dictionary for 3-letter words: the, cat, bag, nor, ega, atc, ron;
-> Hashvalues 00000000000010000000000010010000 the 00000000000010000000000000000101 cat, atc 00000000000000000000000001000011 bag 00000000000000100110000000000000 nor, ron 00000000000000000000000001010001 age, ega Value for pattern _a_ is 00000000000000000000000000000001 Step 3 returns that the keys 00000000000010000000000000000101, 00000000000000000000000001000011 and 00000000000000000000000001010001 are candidates for matches. Step 4 returns: 'cat' and 'bag'
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
“最佳”取决于您拥有的资源。 这是我要做的: 为每个单词长度存储单独的字典。 我假设您的搜索不区分大小写! 如果字符a..z出现在字中,则为每个字存储32位值,其中设置位0到25。 将单词存储在Map
> (键是32位值,value是此键的所有单词的列表) 如何搜索: 拿着想要长度的字典 为您的模式创建32位值。 迭代Map所有键,并检查键的按位和模式的32位值是否等于模式的32位值。 如果不是这不能匹配。 如果通过此检查,则仅仅匹配是不够的,因为它不处理字符的顺序 ... -
(PHP)如何找到以模式开头的单词并替换所有单词?((PHP) How to find words beginning with a pattern and replace all of them?)[2023-04-26]
一个简单的preg_replace将做你想要的 。 尝试: $string = preg_replace('#(/(?:u|r)/[a-zA-Z0-9_-]+)#', '[\1](http://reddit.com\1)', $string); 这是一个例子: http : //ideone.com/dvz2zB 您应该看看是否可以在Reddit名称或Reddit用户名中发现哪些字符有效,并相应地修改[a-zA-Z0-9_-]字符集。 A simple preg_replace will do what ... -
scala:键入图案加工(scala: Type pattern maching)[2023-09-05]
第一个case匹配BigInt任何值。 第二种case在BigInt随BigInt对象上匹配。 def test(obj: Any) = obj match { case _: BigInt => Int.MaxValue case BigInt => -1 } scala> test(BigInt(1)) res2: Int = 2147483647 scala> test(BigInt) res3: Int = -1 也就是说,很可能你真正想要的是第一种情况,除非你有任何特定的理由来检查你 ... -
haskell模式加工 - 许多条件与一个表达式匹配(haskell pattern maching - many conditions matching with one expression)[2021-12-01]
试试看守。 当然, data Message = HELLO | HI | GOODBYE | BYE deriving (Eq) greeting x | x == HELLO || x == HI = "hello" | x == GOODBYE || x == BYE = "bye" 请注意,您必须为您的数据类型派生Eq实例。 查看了解你是一个Haskell的相关部分。 Try guards. Ex, data Message = HELLO | HI | GOODBYE ... -
R - 用模式提取单词并将其替换为反向顺序的单词(R - Extract words with a pattern and replace them with the words in inverse order)[2024-01-21]
我们可以用gsub来捕获单词作为一个组( \\w+ )然后是空格然后将数字作为另一个组捕获,用反向顺序替换它 gsub("(\\w+)\\s+(\\d+)", "\\2 \\1", x) #[1] "I ate 100 apples already. No 50 apples uhmm" "He has 20 apples yeah" We can do this with gsub to capture words as a group (\\w+) followed by space and t ... -
如何在给定的单词列表中找到单词的重复模式?(How to find the repeating pattern of words in the given list of words?)[2022-09-11]
一个非常重要的事情是要知道你想要寻找的模式的大小。 一旦知道了图案长度,就可以创建这些长度的二元组和三元组并检查计数。 代码来做到这一点: my_lst = ['I','Love','Python','very','much','I','Love','Python','good','nice','I','Love','Python','I','Love','Python'] min_Seq_length = 2 max_Seq_length = 3 def find_ngrams(input_list, ... -
试一试 [@|#]((?:\w+\s?){1,2}):\s?((?:\w+\s?){1,})((?:http|https):\/\/.+) 测试 @hello sss: xxx https://t.co/3WHshzDG7m #hello sss: xxx another word https://t.co/3WHshzDG7m #hello sss third: xxx another word https://t.co/3WHshzDG7m 结果 比赛1 [1-10] hello sss [12-1 ...
-
干得好: >>> import re >>> persons = ['Michael', 'Jack', 'Joe', 'Maria', 'Susan'] >>> professions = ['painters', 'actors'] >>> regex = re.compile(r'{person} was one of the few {profession} in {city} whom everybody admired\.' .format(pe ...