I am receiving the following error where the system believes the web.config file is being modified. The actual file shows no changes to the web.config file modified date since the site was last published. The issue shows up when being redirected to another page, though the pages where the issue occurs will change and the error will exist for any user who accesses the site. The issue can be temporarily alleviated by re-publish the application, but in about 24 hours the issue will return. Any ideas why it thinks the file is changing even though it is not?
Current User: NT AUTHORITY\NETWORK SERVICE Target Site: BaseConfigurationRecord.EvaluateOne Error: (System.Configuration.ConfigurationErrorsException) The configuration file has been changed by another program. (E:\PEC\web.config)
StackTrace: at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, Secti开发者_开发知识库onInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName) at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index) at System.Web.Configuration.RuntimeConfig.get_Authorization() at System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
We found this problem was caused by two different applications in IIS being configured to point to the same directory - we had a www.mysite.com and preview.mysite.com; we'd set up preview by using msdeploy
to clone the main site, and not realized that www.mysite.com/foo was a standalone IIS virtual application - so we ended up with www.mysite.com/foo and preview.mysite.com/foo both pointing to the same folder, and 'fighting' over which one of them owned the config file, etc.
Removing the second virtual app fixed the problem.
For me this error was having a web deployment project with web config replacement AND a link to the external config file in the web.config like:
It seems you can only have one or the other. I wrote a blog post on it: http://blog.coultard.com/2012/02/fix-for-web-deployment-project.html
I experienced this on a site I'm developing in Visual Studio.
I managed to solve the error by deleting the site's entire folder (the physical path), accessing the site through the browser, restaring the site and finally publishing the site again from Visual Studio.
精彩评论