我刚刚发现ASP中的每个请求。网络web应用程序在请求开始时获得一个会话锁,然后在请求结束时释放它!

如果你不明白这其中的含义,就像我一开始一样,这基本上意味着:

Any time an ASP.Net webpage is taking a long time to load (maybe due to a slow database call or whatever), and the user decides they want to navigate to a different page because they are tired of waiting, they can't! The ASP.Net session lock forces the new page request to wait until the original request has finished its painfully slow load. Arrrgh. Anytime an UpdatePanel is loading slowly, and the user decides to navigate to a different page before the UpdatePanel has finished updating... they can't! The ASP.Net session lock forces the new page request to wait until the original request has finished its painfully slow load. Double Arrrgh!

那么有什么选择呢?到目前为止,我想出了:

Implement a Custom SessionStateDataStore, which ASP.Net supports. I haven't found too many out there to copy, and it seems kind of high risk and easy to mess up. Keep track of all requests in progress, and if a request comes in from the same user, cancel the original request. Seems kind of extreme, but it would work (I think). Don't use Session! When I need some kind of state for the user, I could just use Cache instead, and key items on the authenticated username, or some such thing. Again seems kind of extreme.

我真不敢相信ASP。Net微软团队在4.0版本的框架中留下了如此巨大的性能瓶颈!我是不是遗漏了什么明显的东西?为会话使用ThreadSafe集合有多难?

我如何让一个JavaScript动作对当前页面有一些影响,但也会改变浏览器中的URL,这样当用户点击重新加载或书签时,就会使用新的URL ?

如果后退按钮可以重新加载原始URL,那就太好了。

我试图在URL中记录JavaScript状态。

我正在查看这里的strlen代码,我想知道在代码中使用的优化是否真的需要?例如,为什么像下面这样的工作不一样好或更好?

unsigned long strlen(char s[]) {
    unsigned long i;
    for (i = 0; s[i] != '\0'; i++)
        continue;
    return i;
}

更简单的代码是不是更好和/或更容易编译器优化?

strlen在链接后面的页面上的代码是这样的:

/* Copyright (C) 1991, 1993, 1997, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se); commentary by Jim Blandy (jimb@ai.mit.edu). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <string.h> #include <stdlib.h> #undef strlen /* Return the length of the null-terminated string STR. Scan for the null terminator quickly by testing four bytes at a time. */ size_t strlen (str) const char *str; { const char *char_ptr; const unsigned long int *longword_ptr; unsigned long int longword, magic_bits, himagic, lomagic; /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = str; ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0; ++char_ptr) if (*char_ptr == '\0') return char_ptr - str; /* All these elucidatory comments refer to 4-byte longwords, but the theory applies equally well to 8-byte longwords. */ longword_ptr = (unsigned long int *) char_ptr; /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits the "holes." Note that there is a hole just to the left of each byte, with an extra at the end: bits: 01111110 11111110 11111110 11111111 bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD The 1-bits make sure that carries propagate to the next 0-bit. The 0-bits provide holes for carries to fall into. */ magic_bits = 0x7efefeffL; himagic = 0x80808080L; lomagic = 0x01010101L; if (sizeof (longword) > 4) { /* 64-bit version of the magic. */ /* Do the shift in two steps to avoid a warning if long has 32 bits. */ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; himagic = ((himagic << 16) << 16) | himagic; lomagic = ((lomagic << 16) << 16) | lomagic; } if (sizeof (longword) > 8) abort (); /* Instead of the traditional loop which tests each character, we will test a longword at a time. The tricky part is testing if *any of the four* bytes in the longword in question are zero. */ for (;;) { /* We tentatively exit the loop if adding MAGIC_BITS to LONGWORD fails to change any of the hole bits of LONGWORD. 1) Is this safe? Will it catch all the zero bytes? Suppose there is a byte with all zeros. Any carry bits propagating from its left will fall into the hole at its least significant bit and stop. Since there will be no carry from its most significant bit, the LSB of the byte to the left will be unchanged, and the zero will be detected. 2) Is this worthwhile? Will it ignore everything except zero bytes? Suppose every byte of LONGWORD has a bit set somewhere. There will be a carry into bit 8. If bit 8 is set, this will carry into bit 16. If bit 8 is clear, one of bits 9-15 must be set, so there will be a carry into bit 16. Similarly, there will be a carry into bit 24. If one of bits 24-30 is set, there will be a carry into bit 31, so all of the hole bits will be changed. The one misfire occurs when bits 24-30 are clear and bit 31 is set; in this case, the hole at bit 31 is not changed. If we had access to the processor carry flag, we could close this loophole by putting the fourth hole at bit 32! So it ignores everything except 128's, when they're aligned properly. */ longword = *longword_ptr++; if ( #if 0 /* Add MAGIC_BITS to LONGWORD. */ (((longword + magic_bits) /* Set those bits that were unchanged by the addition. */ ^ ~longword) /* Look at only the hole bits. If any of the hole bits are unchanged, most likely one of the bytes was a zero. */ & ~magic_bits) #else ((longword - lomagic) & himagic) #endif != 0) { /* Which of the bytes was the zero? If none of them were, it was a misfire; continue the search. */ const char *cp = (const char *) (longword_ptr - 1); if (cp[0] == 0) return cp - str; if (cp[1] == 0) return cp - str + 1; if (cp[2] == 0) return cp - str + 2; if (cp[3] == 0) return cp - str + 3; if (sizeof (longword) > 4) { if (cp[4] == 0) return cp - str + 4; if (cp[5] == 0) return cp - str + 5; if (cp[6] == 0) return cp - str + 6; if (cp[7] == 0) return cp - str + 7; } } } } libc_hidden_builtin_def (strlen)

为什么这个版本运行得很快?

它是不是做了很多不必要的工作?

当我试图运行我的应用程序时,我得到这个错误消息。我不知道怎么解决:

HTTP错误404.3 -未找到页面 您所要求的服务无法提供 因为延伸 配置。如果页面是 脚本,添加一个处理程序。如果文件 应该下载,添加一个MIME映射。

下面是错误页面的截图:

我能做什么来修复这个错误?

在Windows Server 2008下使用ASP。NET 4.0安装了一大堆相关的用户帐户,我不知道哪个是哪个,它们有什么不同,哪个才是我的应用程序运行的。下面是一个列表:

IIS_IUSRS IUSR DefaultAppPool ASP。净v4.0 NETWORK_SERVICE 本地服务。

什么是什么?

我有一个项目,要求我的url在路径上有圆点。例如,我可能有一个URL,例如www.example.com/people/michael.phelps

带有点的url会生成404。我的路由是好的。如果我传入michaelphelps,没有点,那么一切正常。如果我加一个点,就会得到404错误。示例站点运行在Windows 7和IIS8 Express上。URLScan未运行。

我尝试在我的web.config中添加以下内容:

<security>
  <requestFiltering allowDoubleEscaping="true"/>
</security>

不幸的是,这并没有什么不同。我刚刚收到一个404.0未找到错误。

这是一个MVC4项目,但我不认为这是相关的。我的路由工作得很好,我所期望的参数都在那里,直到它们包含一个点。

我需要配置什么才能在我的URL中有圆点?

当我打开解决方案时,我的解决方案文件中有一个“不可用”的web项目。当我右键单击web项目并重新加载项目时,我得到以下错误:

Web应用程序项目mycompany.myapp.mywebproject已配置为使用IIS。无法找到Web服务器http://localhost/MyWebApp。

我还没有为这个web应用程序手动设置虚拟目录。

每个同事,Visual Studio应该提示我创建虚拟目录,但我没有得到提示。

在我的开发机器上安装IIS之前,我安装了VS2010。

这是我的开发机器设置:

Windows 7企业版 服务包1 64位操作系统 Visual Studio 2010企业服务包 IIS 7.5版

传统上,我在本地主机开发服务器上使用自定义域。大致如下:

dev.example.com
dev.api.example.com

这为我在使用外部api(如Facebook)时提供了很大的灵活性。这在过去与内置的Visual Studio Development Server一起工作得很好,因为我所需要做的只是向指向127.0.0.1的DNS记录添加一个CNAME。

但是,我还不能让它与IIS Express一起工作。我所做的一切努力似乎都失败了。我甚至向applicationHost添加了正确的XML配置。IIS Express的配置文件,但它似乎不能像真正安装IIS那样识别有效的条目。

<binding protocol="http" bindingInformation="*:1288:dev.example.com" />

每当我输入这一行并尝试请求http://dev.example.com:1288时,我都会收到以下消息:

错误请求-无效的主机名

有人知道我是否遗漏了什么明显的东西吗?或者IIS Express团队真的缺乏预见到这种类型的使用?

如何快速确定我的ASP的根URL是什么?NET MVC应用程序?例如,如果IIS设置为在http://example.com/foo/bar上为我的应用程序服务,那么我希望能够以一种可靠的方式获得该URL,而不涉及从请求中获取当前URL,并以某种脆弱的方式将其分割,如果我重新路由我的操作,这种方式就会中断。

我需要基本URL的原因是这个web应用程序调用另一个需要根的调用者web应用程序的回调目的。

我使用Visual Studio 2010 RC运行Windows 7 Ultimate(64位)。我最近决定让VS在IIS上运行/调试我的应用程序,而不是在附带的开发服务器上。

然而,每次我尝试运行MVC应用程序,我得到以下错误:

HTTP错误403.14 -禁止Web服务器被配置为不列出此目录的内容。详细的

错误信息

模块DirectoryListingModule

通知ExecuteRequestHandler

汉德勒统计错误

代码0x00000000请求

URL http://localhost: 80 / mySite /

物理 路径C: \ myProject \ mySite \

登录方法匿名登录

匿名用户

我设置了一个默认值。aspx文件在目录中,我收到以下错误:

HTTP错误500.21 -内部服务器 错误处理程序 "PageHandlerFactory-Integrated"有一个 坏模块“ManagedPipelineHandler”在 其模块列表

还有其他我忘了做的步骤吗?

注意:我在安装VS 2010 RC之后安装了iis7.5。在Visual Studio 2010中,我使用了MVC项目的“属性”中“Web”选项卡下的内置“创建虚拟目录”按钮。我确保应用程序使用的是ASP。NET 4应用程序池。

下面是我已经安装的IIS特性。