System.ComponentModel.Win32Exception: 拒绝访问怎么办啊??

liuyuer 2005-08-04 02:03:25
“/EntLibSecTest”应用程序中的服务器错误。
--------------------------------------------------------------------------------

拒绝访问。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.ComponentModel.Win32Exception: 拒绝访问。

源错误:


行 22:
行 23: Dim identity As IIdentity
行 24: authenticated = authprovider.Authenticate(credentials, identity)
行 25:
行 26: If Not authenticated Then


源文件: c:\inetpub\wwwroot\EntLibSecTest\Helper\SecurityHelper.vb 行: 24

堆栈跟踪:


[Win32Exception (0x80004005): 拒绝访问。]

[InvalidOperationException: 无法打开源 {0} 的日志。您可能不具有写访问权。]
System.Diagnostics.EventLog.OpenForWrite() +366
System.Diagnostics.EventLog.WriteEvent(Int32 eventID, Int16 category, EventLogEntryType type, String[] strings, Byte[] rawData) +280
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +462
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category) +21
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID) +15
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) +11
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterInstances.ReportCounterFailure(String message)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterInstances..ctor(String categoryName, String counterName, Boolean createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentedEvent.AddPerformanceCounter(String category, String[] counterNames, Boolean createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentedEvent.Initialize(String counterCategory, String[] counterNames, Boolean createNewInstance, String eventLogSource, EventLogIdentifier[] eventIds)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentedEvent..ctor(String counterCategory, String[] counterNames, Boolean createNewInstance, String eventLogSource, EventLogIdentifier[] eventIds)
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataServiceEvent..ctor(String[] counterNames, EventLogIdentifier[] eventLogIds)
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataConnectionFailedEvent..ctor(String[] counterNames, EventLogIdentifier[] eventLogIDs)
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataConnectionFailedEvent..cctor()

[TypeInitializationException: “Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataConnectionFailedEvent”的类型初始值设定项引发异常。]
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataConnectionFailedEvent.Fire(String connectionString) +0
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataInstrumentationFacade.ConnectionFailed(String connectionString)
Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteScalar(DBCommandWrapper command)
Microsoft.Practices.EnterpriseLibrary.Security.Database.UserRoleManager.GetPassword(String userName)
Microsoft.Practices.EnterpriseLibrary.Security.Database.Authentication.DbAuthenticationProvider.PasswordsMatch(Byte[] password, String userName)
Microsoft.Practices.EnterpriseLibrary.Security.Database.Authentication.DbAuthenticationProvider.Authenticate(Object credentials, IIdentity& userIdentity)
EntLibSecTest.SecurityHelper.Authenticate(String username, String password) in c:\inetpub\wwwroot\EntLibSecTest\Helper\SecurityHelper.vb:24
EntLibSecTest.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\EntLibSecTest\WebForm1.aspx.vb:38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292




--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.2300; ASP.NET 版本:1.1.4322.2300
...全文
913 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuyuer 2005-08-04
  • 打赏
  • 举报
回复
谢谢思归,这个问题昨晚就一直在修改代码,ent lib的代码过于繁乱,剥离不开
多谢您的指点阿
你的速度这么快,是不是总在这上边爬着阿?

承蒙您帮忙好几次了,有没有MSN?
认识一下
saucer 2005-08-04
  • 打赏
  • 举报
回复
you need to run installutil on your app to create those log entries, or see guoguo's blog entry

http://blog.joycode.com/ghj/archive/2005/07/26/60364.aspx
获取U盘ID序列号 VS2005编译通过,源码源自CSDN。已经测试好用。 可以获得U盘名称,制造商ID号 版本号 U盘序列号及容量 Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Management; namespace UDiskTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { DriveInfo[] s = DriveInfo.GetDrives(); foreach (DriveInfo drive in s) { if (drive.DriveType == DriveType.Removable) { pf.Text = drive.Name.ToString(); break; } } ManagementClass cimobject = new ManagementClass("Win32_DiskDrive"); ManagementObjectCollection moc = cimobject.GetInstances(); foreach (ManagementObject mo in moc) { if (mo.Properties["InterfaceType"].Value.ToString() == "USB") { try { //产品名称 Caption.Text = mo.Properties["Caption"].Value.ToString(); //总容量 Size.Text = mo.Properties["Size"].Value.ToString(); string[] info = mo.Properties["PNPDeviceID"].Value.ToString().Split('&'); string[] xx = info[3].Split('\\'); //序列号 MessageBox.Show("U盘序列号:" + xx[1]); PNPDeviceID.Text = xx[1]; xx = xx[0].Split('_'); //版本号 REV.Text = xx[1]; //制造商ID xx = info[1].Split('_'); VID.Text = xx[1]; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } } } 如果编译遇到问题是using System.Management;无法找到引用找到, 项目(p)->添加引用(R)->找到.NET标签页 列表中下部位找到System.Management 双击点确定

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧