单击一次并配置C#应用程序

单击一次并配置C#应用程序,c#,clickonce,app-config,machine.config,C#,Clickonce,App Config,Machine.config,我应该在app.config文件中输入什么以及如何输入 场景是这样的,我创建了一个C#Windows窗体应用程序(4.0),它在开发计算机上运行良好。当我在其他计算机上使用ClickOnce部署它时,我得到了machine.config文件的权限错误。这是一个公司域,因此我无权更改目标计算机上machine.config文件中的权限。从我所阅读的内容来看,我相信在machine.config文件中访问的任何内容都可以交替地放在app.config文件中。问题是我确实了解需要将什么放入app.co

我应该在
app.config
文件中输入什么以及如何输入

场景是这样的,我创建了一个C#Windows窗体应用程序(4.0),它在开发计算机上运行良好。当我在其他计算机上使用ClickOnce部署它时,我得到了
machine.config
文件的权限错误。这是一个公司域,因此我无权更改目标计算机上
machine.config
文件中的权限。从我所阅读的内容来看,我相信在
machine.config
文件中访问的任何内容都可以交替地放在
app.config
文件中。问题是我确实了解需要将什么放入
app.config
文件中,并且我不了解配置的某些方面,例如“键”等

如何完全避免使用
machine.config
文件,以及需要配置什么才能做到这一点

完整的错误详细信息:

平台版本信息
您从哪一行代码中准确地得到了什么错误?您是否有一个关于失败代码的尝试捕获,以便您可以编辑问题并共享失败代码以及引发的异常的堆栈跟踪?向我们显示实际错误消息框中报告的错误如下:dfsvc.exe error“配置分析错误C:\Windows\Microsoft.Net\Framework\V4.0.30319\config\machine.config解析器返回错误0x80070005 Microsoft在此处解释此错误:但我无法更改用户计算机上machine.config文件的权限。错误详细信息对于注释来说太大。我编辑了原始帖子以包含这些详细信息。有关完整的错误详细信息,请参阅原始帖子。您可能有一些其他与安全相关的墙,例如安全设备、虚拟防火墙等,这些墙会阻止访问。可能值得检查。
Windows                  : 5.1.2600.196608 (Win32NT)
Common Language Runtime  : 4.0.30319.296
System.Deployment.dll    : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll                  : 4.0.30319.296 (RTMGDR.030319-2900)
dfdll.dll                : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll               : 4.0.31106.0 (Main.031106-0000)


SOURCES

Deployment URL: file:///P:/Eastops/Region%20C/Conie/HHC/HHC.application


ERROR SUMMARY

Below is a summary of the errors, details of these errors are listed later in the log.

* Activation of P:\Eastops\Region C\Conie\HHC\HHC.application resulted in an exception. The following
  failure messages were detected:

    + Configuration system failed to initialize

    + An error occurred loading a configuration file: Access to the
      path 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is
      denied. (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\machine.config)

    + Access to the path 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\machine.config'
      is denied.


COMPONENT STORE TRANSACTION FAILURE SUMMARY

No transaction error was detected.


WARNINGS

There were no warnings during this operation.


OPERATION PROGRESS STATUS

* [4/17/2013 8:29:25 AM] : Activation of P:\Eastops\Region C\Conie\HHC\HHC.application has started.


ERROR DETAILS

Following errors were detected during this operation.

* [4/17/2013 8:29:27 AM] System.Configuration.ConfigurationErrorsException

- Configuration system failed to initialize
- Source: System.Configuration
- Stack trace:
          at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
          at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
          at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
          at System.Configuration.ConfigurationManager.GetSection(String sectionName)
          at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
          at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
          at System.Diagnostics.DiagnosticsConfiguration.Initialize()
          at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
          at System.Diagnostics.TraceSource.Initialize()
          at System.Net.Logging.InitializeLogging()
          at System.Net.Logging.get_On()
          at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
          at System.Net.WebRequest.Create(Uri requestUri)
          at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
          at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
          at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
          at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
          at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
          at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
          at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
          at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

--- Inner Exception ---

System.Configuration.ConfigurationErrorsException

- An error occurred loading a configuration file: Access to the
  path 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is
  denied. (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\machine.config)

- Source: System.Configuration

- Stack trace:
          at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
          at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
          at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
          at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

--- Inner Exception ---

System.UnauthorizedAccessException

- Access to the path 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied.
- Source: mscorlib
- Stack trace:

          at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
          at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
          at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
          at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName)
          at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions)
          at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName)
          at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName)
          at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()


COMPONENT STORE TRANSACTION DETAILS

No transaction information is available.