Run MVC4 Web App error - asp.net

I'm getting this error when loading my web application:
Server Error in '/' Application.
Compilation Error
Description: 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.
Compiler Error Message: CS0009: Metadata file 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' could not be opened -- 'No metadata was found.'
Source Error:
[No relevant source lines]
Source File: Line: 0
I'm getting pretty much the same error when I go to ASP.NET Configuration > Security :
There is a problem with your selected data store. This can be caused by an invalid
server name or credentials, or by insufficient permission. It can also be caused by the
role manager feature not being enabled. Click the button below to be redirected to a page
where you can choose a new data store.
The following message may help in diagnosing the problem:
(0): error CS0009: Metadata file 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\
v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' could not be opened -- 'No metadata was found.'
Is there any solution to this issue?
I'm using :
Visual studio 2012
iis 8 express
Windows 8 Pro 64bit
Running an MVC3 web app worked successfully.

After repairing VS2012, MVC4 Web Applications seemed to work again. Thanks everyone for your effort.

Related

Compilation Error "The type existits in both..." After Converting a ASP.NET Website To a Web App project

We've recently converted an ASP.NET website targeting .NET 3.5 to a web application project and we're still sorting out the kinks.
When I attempt to access a reporting page I get this error.
Compilation Error
Description: 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.
The type 'MyUserControl' exists in both 'c:\Users\myusername\AppData\Local\Temp\Temporary ASP.NET > Files\root\092fb0a8\177b941c\assembly\dl3\f4bc71b3\a55b6e05_52ded801\MyWebApp.DLL' and 'c:\Users\myusername\AppData\Local\Temp\Temporary ASP.NET Files\root\092fb0a8\177b941c\App_Web_myusercontrol.ascx.cs.6bb32623.zrhw9xjk.dll'
I've tried clearing those temp directories, doing a clean, and setting batch = 'false' in the Web.config. No luck.

ASHX Page Compilation Error

I have a simple .net site built in 4.5 and I have added one web service reference to a SOAP endpoint. The ASHX page works fine in visual studio test server but when I copy to server 2012 server I get this error:
Description: 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.
Compiler Error Message: BC30002: Type 'QTWebService.VehicleInfo' is not defined.
I am confused because this type is contained inside the service reference. What am I doing wrong here? The site runs fine with the dev web server but copy to server 2012 and boom.
Thanks

IIS: Parser Error Message: Could not create type

I am trying to build a simple web service in C# using VS2015 to be hosted on Windows Server 2012R2.
I have the code written and it works properly when hosted in the Visual Studio debugger. The debugger will launch IE and give me the UI to test the simple methods in my code. I can enter a temperature in Celsius and get back the temperature in Farentheit. So my understanding is that my code itself is working.
However, when I publish my project and attempt to load it in IE, I get:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'TestAutomation.AutomationInterface'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="TestAutomation.AutomationInterface" %>
Source File: /TestToolsAutomation/AutomationInterface.asmx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0
I am publishing my project by going to Build -> Publish Web App. I am selecting "File System" as my publish method and am publishing to "C:\inetpub\wwwroot\MyAppName" in the Debug configuration with no check boxes in the File Publish Options. When I publish, I have the following files in the MyAppName folder:
-AutomationInterface.asmx
-Web.config
\App_Code
WebService.cs
The obvious issue I see here is that there is no .dll file created with my compiled code. I'm far from an IIS expert, but isn't this supposed to be created the first time a user requests the page?
I then re-published and checked "Precompile during publishing" in the file options. When I do this, a \bin folder is created with files "App_Code.compiled" and "App_Code.dll" files. However, I get the same error in the browser.
Because my code works in the VS debugger but not when hosted in IIS, I suspect the problem is on the IIS side of things, but I'm not 100% certain of that.
When I request the IIS page in IE, I get an event 1310 with source "ASP.NET 4.0.3.30319.0" in the application event log that says "Event code: 3006
Event message: A parser error has occurred" along with a stack trace that shows a bunch of System.Web.Compilation functions.
I have searched for this error on Stack Overflow and other sites, but none of the suggested solutions appear to solve my particular problem.
I would appreciate any help the community could offer.
UPDATE: I enabled failed request tracing on the server. It appears that the error happens here:
154. view trace
Warning
-MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName
ManagedPipelineHandler
Notification
MAP_REQUEST_HANDLER
HttpStatus
500
HttpReason
Internal Server Error
HttpSubStatus
0
ErrorCode
The operation completed successfully.
(0x0)
ConfigExceptionInfo
ManagedPipelineHandler
I lack the background to fully understand what IIS is trying to tell me. Any tips would be appreciated.
After struggling with this for hours and making all kinds of settings changes, and uninstalling and reinstalling IIS several times, I finally solved this.
I had to right-click on the folder in which I published my files in IIS Manager and select "Convert to Application." It's now working!
Here are a few possible ideas to explore:
Have you looked at the permissions for the account that the Application Pool in IIS is using to run this? There can be ASP.Net Temporary files that aren't being generated that could be an issue here.
Is ASP.Net registered with IIS? I've remembered more than a few times to have to run "aspnet_regiis -i" on servers to install the ASP.Net part so that it'll be present within IIS.
Is IIS configured to allow ASP.Net requests? In the IIS Manager on the machine level there is an "ISAPI and CGI Restrictions" to note.
Update: Perhaps you could look at the configuration for the Application Pool and see which .Net version it is using and whether it is integrated or classic mode. Those would be the next level of things to examine.

Deploying MVC application to Azure with Language Resource Compilation Error

I am deploying an MVC 5 website to a Windows Azure website. Running locally, the site works as expected. When I publish to the site, I get the following error.
Compilation Error
Description: 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.
Compiler Error Message: CS0103: The name 'Resources' does not exist in the current context
After doing some searching around on other sites, one solution that worked for others was to go to the Resource files' properties and set the Build Action to 'Content".
This did not work for me, but setting it to 'Embedded Resource' did.

Problem deploying webservice "Could not create type 'Service'

I have big trouble deploying my webservice. It is the basic helloWorld start webservice.
At my localhost everything os ok. But when I copy the service to my server in my virtual directory i recieve this error:
Server Error in '/' Application.
Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'Service'.
Source Error: Line 1: <%# WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="Service" %>
Source File: /customers/iv_webservice/Service.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
Now I have tried almost everything. Including scanning the web for the past 9 hours for an answer.
I know my virtual directory in the web.config is ok, since I have other virtual websites on my server. I even manage to have aspx. files in the same directory and they are ok.
Now, what am I missing?
Does your web service use a 3rd party assembly or unmanaged Dll that is not deployed to the server? In my experience "cannot create object of type" errors are missing unmanaged Dlls. In the case of missing managed assemblies, the error will usually tell you which assembly is missing.
Can you try compiling the service.vb as an standalone assembly? That might help understand any dependencies you might not be satisfying.. You might also see additional information in Event viewer or if you set the debug mode to true in web.config to see if there are any errors reported compiling service.vb.

Resources