简体   繁体   中英

Can not update my config file in ASP.net in 64 bit OS ,but works fine in 32 bit

I have a Windows service which continuously reads the config file. The UI is a form application and it updates the config file. It works on 32 bit systems. In case of 64 bit, it shows the following error when I try to update the config file. In my log file it shows the following Exception.

System.Configuration.ConfigurationErrorsException: Unable to save config to file 'C:\Program Files\Essel SWolutions\AutomatedBackUpSetUp2\AutomatedBackUp_Form 1.0.0.exe.Config'.
   at System.Configuration.Internal.WriteFileContext.ReplaceFile(String Source, String Target)
   at System.Configuration.Internal.WriteFileContext.Complete(String filename, Boolean success)
   at System.Configuration.Internal.InternalConfigHost.StaticWriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions)
   at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions)
   at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext)
   at System.Configuration.Internal.DelegatingConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext)
   at System.Configuration.UpdateConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext)
   at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
   at System.Configuration.Configuration.SaveAsImpl(String filename, ConfigurationSaveMode saveMode, Boolean forceSaveAll)
   at AutomatedBackUp_Form_1._0._0.configuration.configure(String sourcePathValue, String destinationPathValue, Boolean zipValue, Boolean encryptValue, Boolean mailValue, String frequency, String hour, String minute, String ampm, String time, String sendersid, String recieversid, Boolean txtCheck, Boolean jpgCheck, Boolean zipCheck, Boolean xmlCheck)
   at AutomatedBackUp_Form_1._0._0.ConfigurationForm.updateButton_Click_2(Object sender, EventArgs e)

我认为对于64位计算机,路径将类似于C:\\Program Files (x86)\\..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM