ASP.NET runtime error: An error occurred loading a configuration file - asp.net

C:\Users\****\StorageFolder\WEB\MyPage\MyPage.aspx: ASP.NET runtime error: An error occurred loading a configuration file: Invalid file name for file monitoring: 'C:\Users\****\StorageFolder\WEB\web.config'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory
- Access denied. (C:\Users\****\StorageFolder\WEB\web.config)
The error occurs on this line of the aspx file:
<%# Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Templates/Default.master" CodeFile="MyPage.aspx.vb" Inherits="MyPage" %>
This issue happens when I'm trying to open MyPage.aspx and MyPage.aspx.vb. This is NOT a website project or visual studio project in any way, just two individual files sitting in a folder.
For the path it is referring to, that web.config it references is a folder containing a web.config file.
There is no web project or visual studio project relating to these files. I am not editing this on a web server. VS2012 should have no interest at all in that web.config folder as far as I can tell, so why does it?
If I rename that web.config folder to something else, the error when opening the page files vanishes, but why is this happening at all?

Related

How to change asp .net web service application build path instead of bin folder?

I am working asp.net web service application.
Normally running time my application dll taken from bin directory.
now i want to add some XML file and folder,so i want to change web service build directory.
I changed directory like this [ex:bin\Common],but this kind of issue came.
Parser Error
Parser Error Message:** Could not create type 'WebService.MainLogic'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="MainLogic.asmx.cs" Class="WebService.MainLogic" %>
Source File: /MainLogic.asmx Line: 1
How can I change the directory?
you can copy bin folder to specific folder after build project.
Right Click on project and go to properties => Build Events
in Post-build event command line write below command :
xcopy /Q /Y "$(TargetPath)" "C:\path\to\somewhere\"
for more information see this link : Copy bin files on to Physical file location on Post Build event in VS2010

ASP.NET MVC 5 error: The type exists in both directories

I am working with Resource files. Previously it was in root directory and it was working in local system only not in build server
So i changed that files to App_ResourceFiles. Now whenever i am running the system its showing error
e:\Project\Views\Shared\_Layout.cshtml(20): error CS0433: The type 'Resources.Resources' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b16288ea\ad7e7d58\assembly\dl3\84b4e25c\954d49a2_04b6cf01\Project.UI.DLL' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b16288ea\ad7e7d58\App_GlobalResources.687j25cv.dll'
I restarted the VS2013...deleted the root folder temp files and re-open the solution and clean and rebuild it.
But still it showing the same error again.
any help would be appreciable
Did you check the Project file?
And you might want to change the namespace.
see http://msdn.microsoft.com/en-us/library/64wh5743.aspx

Why are aspx files with <script> ignoring CompilerOptions directive containing version

I am manually specifying CompilerOptions in the aspx Page directive to point to an assemblyinfo.cs file so that the aspnet_compiler compiles the dll and sets the file version on the file per this site: http://msdn.microsoft.com/en-us/library/ms228042(v=vs.100).aspx
This works great on pages with no script tags in them, but if there is a script tag in the aspx page, the file version and product name is not set on the compiled file.
Looking at the aspnet_compiler cmdline output in Temporary ASPNET Files, I can see that if I include any tags in the aspx page the commandline is:
...(bunch of refs).../out:{filehere} /D:DEBUG /debug+ /optimize- /win32res:"{path}\Temporary ASP.NET Files\ _test\baa9b374\3a3079a4\55vmujzi.res" /w:4 /nowarn:1659;1699;1701 C:\MyFile\AssemblyInfo.cs /warnaserror- {filename.0.cs} {filename.1.cs}
If I look at the aspnet_compiler output without the script in the aspx page, the /win32res parameter is not present and everything works great.
What magic step do I need to perform to get the aspnet_compiler to include the scripts AND use the proper assemblyinfo.cs information to set file version?
I am using the .NET 4 aspnet_compiler.

Error while publish MVC3 project

Error 1 Copying file Content\themes\base\AdminHomeImages\GiftControl.jpg to obj\Debug\Package\PackageTmp\Content\themes\base\AdminHomeImages\GiftControl.jpg failed. Could not find file 'Content\themes\base\AdminHomeImages\GiftControl.jpg'. 0 0 ResturantManager
I get the above error while publishing MVC3 project.. What should i do to solve it.
When you choose to Publish the Project and Let's say your Publish Method is "File System" that means you are copying your necessary files from one location to another location. The Index of these files are mentioned in your project file. You have two options below
(a) Remove the Index of these files(Files causing Compilation Error) from your Project File and Publish
(b) It is must to keep the Project related Files to their exact location(Files that causing Compilation Error, Try keeping a fake file with same name and same Extension). This relative path is mentioned in your project file. Publish now
This Compilation Error will not be shown when you Rebuild/Build the application.

Problems with ReportViewer assemblies in VS2010

I'm using the ReportViewer 10.0.0.0 from VisualStudio2010 into my Web Application and I'm having problems with it's assemblies.
The server have ReportViewer 8.0.0.0 and 9.0.0.0 installed and I'm trying to avoid the installation of the 10.0.0.0 version.
I was thinking if it's possible to use the ReportViewer10 dll's on the server even not having it installed. I set the Build Action property of the dlls to Content for them to be copied to the output bin folder. The property Copy to Output Directory is Do not copy.
As the following error shows, my project is finding two assemblies from ReportViewer, one in the GAC and another in the Temporary ASP.NET Files. Searching, I've discovered too that the Temporary ASP.NET Files are re-generated each request to the server.
Trying to solve my problem, I deleted the dll from the Temporary ASP.NET Files and the whole application stop working, showing that my application was using the dll from the Temporary ASP.NET Files, not from GAC or the bin folder. I want to set my application to use the dll from the bin folder OR the Temporary ASP.NET Files, because in these places the dll is in it's correct version (10.0.0.0). The error below shows a conflict between the ReportViewer9 dlls from GAC and ReportViewer10 dlls from Temporary ASP.NET Files.
An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both
'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\assembly\dl3\662a86a1\009c93d3_afeccc01\Microsoft.ReportViewer.WebForms.DLL'
Line 180:
Line 181: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 182: private global::Microsoft.Reporting.WebForms.ReportViewer #__BuildControlReportViewer1() {
Line 183: global::Microsoft.Reporting.WebForms.ReportViewer #__ctrl;
Line 184:
Source File: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\App_Web_default.aspx.cdcab7d2.dmkwuxko.0.cs
Line: 182
My problem was solved by doing the following:
I left the dlls be referenced by my project but I've removed them from the bin folder. This way the dll's stopped being re-generated inside Temporary ASP.NET Files folder, ending the conflict:
CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both
'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\assembly\dl3\662a86a1\009c93d3_afeccc01\Microsoft.ReportViewer.WebForms.DLL'
Report Viewer kept not working, how it was expected to (GAC had only versions 8 and 9 of the dlls). Then the Report Viewer 10.0.0.0 was installed on the server, and this time a new error has shown:
CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both
'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'
I thought that was strange that this conflict had happened between different versions of the dlls, and this time the solution was to add the following tag to the web.config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
<dependentAssembly>
<assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="b03f5f7f11d50a3a"/>
<bindingRedirect oldVersion="9.0.0.0" newVersion="10.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
Done. It worked without any conflict and it was possible to export the reports.
My problem was solved, but I still have one doubt, and I hope someone help me with this one:
Why did the server had the conflict between two dll's from GAC_MSIL within different versions? Shouldn't the server look only for the version I've referenced in my project and specified in the Web.config? (10.0.0.0)
Does it have any relation with the machine.config file?

Resources