ASP.net

填充无效,无法被移除(Padding is invalid and cannot be removed)

在对使用Rijndael加密后的密文进行解密的时候,出现不能解密,并且抛出异常CryptographicException(“填充无效,无法移除”)。是执行CryptoStream.Read(…)语句之后出现的异常。

在检查对称加密算法代码不存在问题后,使用对称算法对密文的明文重新加密后发现二者并不一致,最后发现原来是原密码加密时使用的公钥与当前加密算法的公钥不一致。

More >

试图运行项目时出错:无法在web服务器上启动项目的解决办法

在Visual Studio中启动Web项目的调试时,出现如下的错误(错误提示见附件): 
    自动附加到计算机“Firehack”上的进程“[5676] w3wp.exe”失败。错误代码为 0×8013134b
    Auto-attach to process ‘[2440] w3wp.exe’ on machine ‘Firehack’ failed. Error code 0×8013134b. 

其中关键的一点是出现了一个错误代码 0×8013134b。

出现这个错误的原因很简单:因为安装ASP.NET 2.0(或者针对.NET 2.0的补丁) 后,.NET 2.0 自动将IIS中所有的站点属性中的“ASP.NET版本” 设置为 2.0.50727,虽然站点仍旧能够正常访问,但是Visual Studio 2003就无法启动调试了的。

因此解决方法也就出现:

  1. 打开“Internet 信息服务(IIS)管理器),开始-运行-inetmgr;
  2. 在出现问题的站点上右键-属性;
  3. 选中“ASP.Net”标签;
  4. 修改“ASP.NET版本” 为 1.*.*;
  5. 应用后,重新启动调试。

————–英文信息—————

Attached the process w3wp.exe on my machine.  Then I got the following error:

Auto-attach to process ‘[2440] w3wp.exe’ on machine ‘…’ failed. Error code 0×8013134b.

The problem was that I had installed .NET 2.0 which had registered ASP.NET 2.0 on the Web Site I was trying to debug.

Fixing it is simple:

  • Run the IIS Manager
  • Right click on the web site with the problem
  • Click the ASP.NET tab
  • Change the ASP.NET version from 2.something to 1.something in the combo and debugging works again

Upon changing to 1.something, the debugging worked.

图片附件:
0x8013134b.png

程序“[1912] w3wp.exe: DefaultDomain”已退出,返回值为 0 (0×0)

使用Visual Studio 2003/2005调试ASP.NET程序时出现如下错误,从而无法调试:
程序“[1912] w3wp.exe: DefaultDomain”已退出,返回值为 0 (0×0)。
  对应的英文信息为: 
The program ‘[5772] w3wp.exe: demo’ has exited with code 0 (0×0).
这个问题是IE8的 Loosely-Coupled Internet Explorer (LCIE) 引起的,解决方法如下:

对于Windows 2003/Windows XP 操作系统:
1)  Open RegEdit //打开注册表编辑器
2)  Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main //定位到【HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main】
3)  Add a dword under this key called TabProcGrowth //新建名称为 TabProcGrowth 的Reg_DWORD(整数值)
4)  Set TabProcGrowth to 0 //设置 TabProcGrowth 的值为 0
重新启动调试,就恢复正常

如果是Vista或者更新的Win7上则需要:turn off protected mode。

解决方案来源:
VS 2005 Debugger crashing with IE 8 Beta 2

IE 8 has a feature called Loosely-Coupled Internet Explorer (LCIE) which results in IE running across multiple processes. 
http://www.microsoft.com/windows/internet-explorer/beta/readiness/developers-existing.aspx#lcie

Older versions of the Visual Studio Debugger get confused by this and cannot figure out how to attach to the correct process.  You can work around this by disabling the process growth feature of LCIE.  Here’s how:

1)  Open RegEdit
2)  Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3)  Add a dword under this key called TabProcGrowth
4)  Set TabProcGrowth to 0

Since you are running on Windows Server 2003, this is all you should need to do.  If you run into the same problem on Vista or newer, you will also need to turn off protected mode.

附件:error.txt(7215 Byte)

VS2003打开.net工程提示"无法读取项目文件portal.csproj.系统找不到指定路径"

使用Microsoft Visual Studio 2003打开.net解决方案时提示(如截图1所示):
—————————
Microsoft Development Environment
—————————
无法读取项目文件“portal.csproj”。系统找不到指定的路径。 
—————————
确定   
—————————

经过检查浏览器的代理设置,重新定位portal项目的位置,检查portal.csproj.webinfo文件等操作都无法解决此问题。

同时发现如果在删除portal项目后新建同名的项目时会提示:项目错误。

奇怪的VS2003!

在最后无路可走时,把解决方案ZhongNan.sln目录中的同名文件ZhongNan.suo(为隐藏文件)删除,如截图2所示,结果VS2003正常了。

 

The solution user options (.suo) file is a structured storage, or compound, file stored in a binary format. You save user information into streams with the name of the stream being the key that will be used to identify the information in the .suo file.

{VS打开.net工程提示"无法读取项目文件"web.csproj",系统找不到指定路径"}其他可能的原因:

http://hi.baidu.com/kmiaoer/blog/item/75f502083b463f38e8248805.html

解决 无法读取项目文件"***.csproj",系统找不到指定路径

以上情况可能由于2个问题出现的,1 路径不对。 2 开发工具与打开工具版本不对

解决办法:

解决路径不对:

针对路径不对,我们可以用以下办法解决

    用记事本打开sln文件,将绝对路径修改为相对路径就行了 

例如: 

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "E:\AJAXEnabledWebSite1\", "E:\AJAXEnabledWebSite1\", "{FDDDB5AF-ECE6-4DB1-AB85-0C242B0DFFFA}" 

将两个E:\AJAXEnabledWebSite1改成AJAXEnabledWebSite1就行了

解决版本不对:

   第一步:用记事本打开解决方案文件[解决方案名].sln,然后修改最上面两行为如下代码: 

Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 



如:Microsoft Visual Studio Solution File, Format Version 10.00 

# Visual Studio 2008 

你把它改成: 

Microsoft Visual Studio Solution File, Format Version 9.00 

# Visual Studio 2005
 

   第二部:用记事本打开每个项目文件[项目名].csproj,在<PropertyGroup>节点下移除如下节点: <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> 并且修改ProductVersion和Import两个节点为如下: <ProductVersion>8.0.50727</ProductVersion> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 这样应该就可以打开了

图片附件:
vs2003-error.png

图片附件:
vs2003-error-fix.jpg

GDI+ 中发生一般性错误 的解决方法

本文引用自:http://www.cnblogs.com/yeagen/archive/2009/01/21/1361168.html

通过ASP.net操作图像地过程中,最后将图像由BMP转换格式为PNG输出到前台时出现“GDI+ 中发生一般性错误”的解决办法如下:

将 bitmap.Save(page.Response.OutputStream, ImageFormat.Png);

改为:

        MemoryStream MemStream = new MemoryStream(); 
        bitmap.Save(MemStream, ImageFormat.Png);
        MemStream.WriteTo(page.Response.OutputStream);

 

无法在Web服务器上启动调试。与Web服务器通信时出现身份验证错误

使用Visual Studio 2005(Visual Studio 2008亦存在此问题)调试设置了主机头的网站时出现如下错误信息:

—————————
Microsoft Visual Studio
—————————
无法在 Web 服务器上启动调试。与 Web 服务器通信时出现身份验证错误。请参阅“帮助”以协助解决问题。
—————————

项目属性的Web中设置“项目URL”为 http://www.msdi.cn/MultiWeb

如果将“项目URL”指定为 localhost 则在设置时不会出现以上的错误,所以排除了网上绝大部分文章提供的“集成Windows身份验证”,项目属性中“启用调试”的解决方案。

真正的解决方法如下:

步骤 1: 禁用环回检查
请遵循以下步骤:
1. 打开注册表编辑器(单击 开始 , 单击 运行 , 类型 regedit然后单击 确定 )。
2. 中注册表编辑器, 找到并单击以下注册表项:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
3. 右击 Lsa , 指向 新建 , 然后单击 DWORD 值 。
4. 类型 DisableLoopbackCheck然后按 Enter。
5. 右击 DisableLoopbackCheck , 然后单击 修改 。
6. 在 数值数据 框中, 键入 1然后单击 确定 。
7. 退出注册表编辑器, 并重新启动计算机。 (可以不重启计算机)

步骤 2: 指定主机名
要指定主机名, 映射到环回地址并可连接到 Web 站点上, 请按照下列步骤:
1. 打开注册表编辑器(单击 开始 , 单击 运行 , 类型 regedit然后单击 确定 )。  。
2. 中注册表编辑器, 找到并单击以下注册表项:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
3. 右击 MSV1_0 , 指向 新建 , 然后再单击 多字符串值 。
4. 类型 BackConnectionHostNames然后按 Enter。
5. 右击 BackConnectionHostNames , 然后单击 修改 。
6. 在 数值数据 框中, 键入主机名或主机名为站点所在的本地计算机名称,  确定 。
7. 退出注册表编辑器, 并重新启动 IISAdmin 服务。

这个错误的信息只会出现在特定环境的计算机中:This issue only appears on Web Sites configured with a host header on machines with IIS 6 or IIS 5.1 and the RTM version of the .Net Framework 3.5 SP1.

参考文章:
当您浏览位置 IIS 5.1 或 IIS 6 上的网站并且使用集成身份验证时,会收到 401.1 错误
Debugging A Web Site With A Host Header