在“/asp.netwebadminfiles应用程序的服务器错误 - VS 2013 [英] Server Error in '/asp.netwebadminfiles' Application - VS 2013

查看:388
本文介绍了在“/asp.netwebadminfiles应用程序的服务器错误 - VS 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与ASP.Net Web应用程序的工作,我想创建一个成员资格用户,所以我要访问Web配置工具ASP.NET。我已经运行提示IISEx preSS命令和它的工作正常,但每当我运行<$c$c>http://localhost:5376/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\\Users\\user\\Documents\\Visual%20Studio%202013\\Projects\\MyWebsite&applicationUrl=/在浏览器中我得到这个错误!

错误消息:


  

在服务器错误/asp.netwebadminfiles应用程序。


  
  

编译错误


  
  

描述:资源的编译过程中出现错误
  此请求提供服务所需。请检查下列特定
  错误详细信息并适当地修改源$ C ​​$ C。


  
  

编译器错误信息:CS0122:'System.Configuration.StringUtil'是
  人迹罕至,由于其保护级别


  
  

源错误:


  
  

987线:


  
  

988线://把一些独特的应用程序ID


  
  

989线:字符串的appid = StringUtil.GetNonRandomizedHash code(String.Concat(APPPATH,appPhysPath))的ToString(X,CultureInfo.InvariantCulture);


  
  

990线:


  
  

991线:


  
  

源文件:
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASP.NETWebAdminFiles \\ APP_ code \\ WebAdminPage.cs
  行:989



解决方案

我发现这个<一个答案href=\"http://blogs.msdn.com/b/webdev/archive/2013/08/19/asp-net-web-configuration-tool-missing-in-visual-studio-2013.aspx\"相对=nofollow>后从Mr_Coinche评论的一路下滑。


  

对于那些谁所遇到的CS0122:
  'System.Configuration.StringUtil'不可访问由于其
  保护级别的问题。这是.NET的4.6惹的祸。


  
  

所以,你可以卸载这个框架(如果你使用的是Windows 8),用于
  那些谁正在使用的窗口10,它似乎很难或不可能
  卸载.NET 4.6,因为它是与Windows 10安装。


  
  

因此​​,有一种替代方法,您可以修改


  
  

C:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ ASP.NETWebAdminFiles \\ APP_ code \\ WebAdminPage.cs
  文件code或


  
  

C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASP.NETWebAdminFiles \\ APP_ code \\ WebAdminPage.cs
  ,(取决于您要安装)


  
  

替换行


 字符串的appid = StringUtil.GetNonRandomizedHash code(String.Concat(APPPATH,appPhysPath))的ToString(X,CultureInfo.InvariantCulture)。


  

这些行:


 大会SYSCONFIG = Assembly.LoadFile(@C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ System.Configuration.dll);
键入sysConfigType = sysConfig.GetType(System.Configuration.StringUtil);
字符串的appid =((INT)sysConfigType.GetMethod(GetNonRandomizedHash code)
  .Invoke(空,新的对象[] {String.Concat(APPPATH,appPhysPath),真}))
  的ToString(×,CultureInfo.InvariantCulture);

此外,请确保运行记事本(或任何code编辑选择)作为管理员,否则您将没有权限来保存文件,一旦你所做的更改。我做了改变这两个文件 - 这是调用同样的方法只是用不同的方式,但在某种程度上,它与在.NET中4.6的新的保护水平相一致。

I'm working with ASP.Net web application and i want to create a membership user so i have to access the Web Configuration Tool for ASP.NET . i have run IISExpress commands in Prompt and it's works fine but whenever i run the http://localhost:5376/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Users\user\Documents\Visual%20Studio%202013\Projects\MyWebsite&applicationUrl=/ in the browser i got this error !

the error message :

Server Error in '/asp.netwebadminfiles' Application.

Compilation Error

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

Compiler Error Message: CS0122: 'System.Configuration.StringUtil' is inaccessible 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.cs Line: 989

解决方案

I found the answer in this post way down in the comment from 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);

In addition, make sure you run Notepad (or whatever code editor you choose) As Administrator, otherwise you won't have permissions to save the file once you've made the change. I made the change to both files - it's just a different way of calling the same method, but in a way that is consistent with its new protection level in .NET 4.6

这篇关于在“/asp.netwebadminfiles应用程序的服务器错误 - VS 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆