gpt4 book ai didi

asp.net - '/asp.netwebadminfiles'应用程序中的服务器错误-VS 2013

转载 作者:行者123 更新时间:2023-12-03 07:54:09 24 4
gpt4 key购买 nike

我正在使用ASP.Net Web应用程序,并且想创建一个成员资格用户,因此我必须访问ASP.NET的Web配置工具。我已经在提示符下运行IISExpress命令,它的工作原理很好,但是每当我在浏览器中运行http://localhost:5376/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Users\user\Documents\Visual%20Studio%202013\Projects\MyWebsite&applicationUrl=/时,我都会收到此错误!
错误消息:

Server Error in '/asp.netwebadminfiles' Application.

Compilation Error

Description: An error occurred during the compilation of a resourcerequired to service this request. Please review the following specificerror details and modify your source code appropriately.

Compiler Error Message: CS0122: 'System.Configuration.StringUtil' isinaccessible due to its protection level

Source Error:

Line 987:

Line 988: // Put together some unique app id

Line 989: string appId =StringUtil.GetNonRandomizedHashCode(String.Concat(appPath,appPhysPath)).ToString("x", CultureInfo.InvariantCulture);

Line 990:

Line 991:

Source File:c:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles\App_Code\WebAdminPage.csLine: 989

最佳答案

我在Mr_Coinche的评论中找到了答案。

For those who are encountering the "CS0122: 'System.Configuration.StringUtil' is inaccessible due to its protection level" issue. It's the fault of .net 4.6.

So you can uninstall this framework (if you are on windows 8), for those who are using windows 10, it's seems difficult or impossible to uninstall .net 4.6 because it's install with windows 10.

So there is an alternative, you can modify the

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\ASP.NETWebAdminFiles\App_Code\WebAdminPage.cs file code or

c:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles\App_Code\WebAdminPage.cs , (depending which you are trying to install)

Replace the line


string appId = StringUtil.GetNonRandomizedHashCode(String.Concat(appPath, appPhysPath)).ToString("x", CultureInfo.InvariantCulture);

with these lines:


Assembly sysConfig = Assembly.LoadFile(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll");
Type sysConfigType = sysConfig.GetType("System.Configuration.StringUtil");
string appId = ((int)sysConfigType.GetMethod("GetNonRandomizedHashCode")
.Invoke(null, new object[] { String.Concat(appPath, appPhysPath), true }))
.ToString("x", CultureInfo.InvariantCulture);

此外,请确保以“管理员”身份运行“记事本”(或选择的任何代码编辑器),否则进行更改后,您将无权保存文件。我对这两个文件进行了更改-这只是调用同一方法的一种不同方法,但其方式与.NET 4.6中的新保护级别一致

关于asp.net - '/asp.netwebadminfiles'应用程序中的服务器错误-VS 2013,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32321757/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com