最近写了一个asp.net小系统...在本地调试部署没问题...运行环境: windowXP + IIS V5.1 + .net framework 1.1由于数据库访问层用的是websharp...而此项目在运行时生成一些缓存的程序集dll...程序部署到远程服务器上时...(注:跟网络空间提供商购买的网站空间)...运行程序时(用户登陆)出错...产生问题: 1. 提示在缓存文件夹找不到这些临时产生的程序集...    因为在我本地部署运行时缓存文件夹中会产生的...之后修改websharp项目把生成的临时文件路径改为web应用程序的一个目录中...运行系统提示异常信息:产生问题: 2 .异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权...详情如下:堆栈跟踪: [SecurityException: 不允许所请求的注册表访问权。]
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +440
   System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName, Boolean useMutex) +445
   System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName) +11
   System.Diagnostics.EventLog.CreateEventSource(String source, String logName) +11
   Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() +52 
问: 1...产生问题1的情况是否是因为访问远程服务器是没有对缓存文件夹写权限而引起的?     2...问题2的情况什么原因造成的?跟修改了websharp生成的缓存文件路径是否有关系?跟web.config配置正确是否有关系吗?(websharp的相关配置信息上网查了之后都一样)注: 本人对websharp仅处于了解与使用的水平,有没朋友遇到过类似的问题?希望能够解答.谢谢.附web.config中websharp的相关配置信息如下:<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  <section name="Websharp.Aspects" type="Websharp.Aspect.AspectConfigHandler,Websharp.Aspect"/>
  <section name="Websharp.Enterprise" type="Websharp.Enterprise.EnterpriseConfigHandler,Websharp.Enterprise"/>
  <section name="CacheManagerSettings" type="Microsoft.ApplicationBlocks.Cache.CacheConfigurationHandler,Microsoft.ApplicationBlocks.Cache"/>
  <section name="WebsharpExpirationPolicy" type="Websharp.ORM.Service.WebsharpCofigurationHandler,Websharp.ORM.Service"/>
  </configSections>
  
  <CacheManagerSettings>
  <DataProtectionInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.DataProtection.DefaultDataProtection" ValidationKey="Oci44OQ9C3xAdQ3/BMHpksPfzeTezLkXen/ahQ8T7nVk/KMgAFnssQJr00KUNhRso+MpLVwAinGep6i14X9M+A==" Validation="SHA1"/>             
  <StorageInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.Storages.SingletonCacheStorage" Mode="InProc" Validated="true" Encrypted="true" RemotingUrl="tcp://localhost:8282/CacheService"/>
  <ScavengingInfo AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.Scavenging.LruScavenging" MemoryPollingPeriod="60" UtilizationForScavenging="80" MaximumSize="5"/>
  <ExpirationInfo Interval="1"/>
  </CacheManagerSettings>
 
  <WebsharpExpirationPolicy>
  <ExpirationPolicy ExpirationCheckInterval="60" AssemblyName="Microsoft.ApplicationBlocks.Cache" ClassName="Microsoft.ApplicationBlocks.Cache.ExpirationsImplementations.SlidingTime"/>
  </WebsharpExpirationPolicy>  <appSettings>    ...... <appSettings> <system.web>    ......</system.web></configuration>

解决方案 »

  1.   

    原因
    默认情况下,ASP.NET 工作进程的用户令牌是 ASPNET(或者,对于 Internet 信息服务 [IIS] 6.0 上运行的应用程序是 NetworkService)。由于您的帐户不具有创建事件源的正确用户权限,会出现“症状”部分中的问题。
    解决方案
    警告:注册表编辑器使用不当可导致严重问题,从而可能需要重新安装操作系统。Microsoft 不能保证您可以解决因注册表编辑器使用不当而导致的问题。使用注册表编辑器需要您自担风险。 要解决此问题,在您运行 ASP.NET Web 应用程序之前,拥有管理权限的用户必须创建事件源。要创建事件源,请使用下列方法之一。
    第一种方法
    在注册表编辑器中,在应用程序事件日志下创建一个事件源。为此,请执行下列步骤: 1. 单击“开始”,然后单击“运行”。 
    2. 在“打开”文本框中,键入 regedit。 
    3. 找到以下注册表子项:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application 
    4. 右键单击“Application”子项,指向“新建”,然后单击“项”。 
    5. 键入 TEST 作为该项的名称。 
    6. 关闭注册表编辑器。 第二种方法
    System.Diagnostics 名称空间中的 EventLogInstaller 类允许您安装和配置一个事件日志,您的应用程序在运行时可以读取或写入该事件日志。您可以使用 EventLogInstaller 创建一个事件源。为此,请执行下列步骤: 1. 使用 Microsoft Visual Basic .NET 或 Microsoft Visual C# .NET 创建一个新的名为 EventLogSourceInstaller 的“类库”。默认情况下,将创建“Class1.vb”文件或“Class1.cs”文件。 
    2. 在解决方案资源管理器中,右键单击“EventLogSourceInstaller”,然后单击“添加引用”。 
    3. 在“添加引用”对话框中,双击“System.Configuration.Install.dll”,然后单击“确定”。 
    4. 将 Class1.vb\Class1.cs 重命名为 MyEventLogInstaller.vb\MyEventLogInstaller.cs。 
    5. 用以下示例代码替换 MyEventLogInstaller.vb 或 MyEventLogInstaller.cs 中现有的代码:Visual Basic .NET 示例Imports System.Diagnostics
    Imports System.Configuration.Install
    Imports System.ComponentModel<RunInstaller(True)> _
    Public Class MyEventLogInstaller
        Inherits Installer
        Private myEventLogInstaller As EventLogInstaller    Public Sub New()
            ' Create an instance of 'EventLogInstaller'.
            myEventLogInstaller = New EventLogInstaller()
            ' Set the 'Source' of the event log, to be created.
            myEventLogInstaller.Source = "TEST"
            ' Set the 'Log' that the source is created in.
            myEventLogInstaller.Log = "Application"
            ' Add myEventLogInstaller to 'InstallerCollection'.
            Installers.Add(myEventLogInstaller)
        End Sub 
    End Class Visual C# .NET 示例using System;
    using System.Diagnostics;
    using System.ComponentModel;
    using System.Configuration.Install;
    namespace EventLogSourceInstaller 
    {
    [RunInstaller(true)]
    public class MyEventLogInstaller : Installer
    {
    private EventLogInstaller myEventLogInstaller; public MyEventLogInstaller()
    {
    //Create Instance of EventLogInstaller
    myEventLogInstaller = new EventLogInstaller(); // Set the Source of Event Log, to be created.
    myEventLogInstaller.Source = "TEST"; // Set the Log that source is created in
    myEventLogInstaller.Log = "Application";

    // Add myEventLogInstaller to the Installers Collection.
    Installers.Add(myEventLogInstaller);
    }
    }
    }
     
    6. 在“生成”菜单中,单击“生成解决方案”以生成“EventLogSourceInstaller.dll”。 
    7. 打开“Visual Studio .NET 命令提示符”。 
    8. 在该命令提示符下,更改到“EventLogSourceInstaller.dll”所在的文件夹。 
    9. 运行以下命令以生成 EventSource:
    InstallUtil EventLogSourceInstaller.dll 
      

  2.   

    谢谢你的方法...websharp项目不熟...网上搜索的跟你说的一样...但服务器上不知道是否允许这样做...如果真要这样做的话..那网站的部署方面是很麻烦的了...
    暂告一段落吧...依然感谢你...结贴送分...