When I launch my website from IIS, I get this error:
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 load type 'MonitoringToolUI.Global'.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="MonitoringToolUI.Global" Language="C#" %>
Source File: /global.asax Line: 1
I found duplicates of this issue, several actually - Parser Error Message: Could not load type 'TestMvcApplication.MvcApplication', "Parser Error Message: Could not load type" in Global.asax but none of the solutions given seem to be working for me. The solution which worked for most of them is that they cleaned/rebuilt the solution and it worked. In my case it is an installed website, using a MSI to create the web application in my IIS. I have tried rebuilding my application and reinstalling it, the same issue persists. However this application launches if I run it otherwise so guessing it is an installer issue.
I am using VS2012 and was forced to use InstallShield to deploy my web application. I followed a tutorial(http://www.c-sharpcorner.com/UploadFile/cb88b2/simple-steps-to-create-setup-of-website-using-install-shield/) and was able to create my installer. It creates a virtual directory, the content files/project output are copied correctly.
I've checked the .net version, platforms, rebuilt the solution several times. Am not sure what to try next, any suggestions would be helpful.
Note: One of the things I tried, I removed the "inherit" part from the global.asax file and then a similar error was thrown from one of the aspx files. Instead of gloabal, it was a different file name.
Thank you!
Make sure you the dlls are inside the bin folder in the virtual directory or your application directory.
For that you should import the Primary Output of your project inside the bin folder
Check out this link:
http://helpnet.flexerasoftware.com/installshield16helplib/webservices.htm
Related
I am getting ASPNETCOMPILERERROR while publishing a web project.
This project is in .net 4.0 and we are publishing in VS2012.
Build is getting succeeded, but while publishing we are getting following error
ASPNETCOMPILERERROR - object reference not set to an instance of object.
Please let us know how to resolve the issue.
I am able to solve the issue.
One of the dll causing reference issue, but build is getting succeed.
Solved by following these steps
Checked in the temporary folder(C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files) where VS Creates dlls for each page( i have opted for individual assemblies while publishing)
Before creating dlls, it generates .Compiled files and then converts each file to a dll.
we found one of the page is not getting converted to dll, instead it created a file with .delete extension and halted.
Now we ran our application from VS and tried open the page which is not able getting converted to dll.
Now we got the issue as an exception.
Hope this will help some one else.
When I build a web site I haven't got errors, but when I try to publish site the error appears:
Type 'AttachmentsControl' exists in both в 'c:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\web.ui.application\8c85983a\5425041a\App_Web_mivbsgll.dll' and 'c:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\web.ui.application\8c85983a\5425041a\App_Web_dhvduebi.dll'
I tried to add the batch="false" attribute to the "compilation" element of the web.config file, but this didn't help.
Also I tried to rename one class, but in this case another error appears:
Server Error in '/projectName' Application.
Thread was being aborted.
Can anybody help me?
P.S.: the most strangest thing is that I get this project from MS TFS, my colleague who add this project to TFS publish this site without errors.
Most probably the reason could be you are uploading the source files along with compiled published output and at the same time the source files are modified.
When you see this error, what asp.net is trying to do is, compile the files and create the application and the result is, you have two type declaration of same name, one in the dll and one in the source.
Try to delete the dll file you have uploaded (from the bin directory), it should resolve the issue.
This isn't really a question on a problem; I've solved it my own (after banging my head against a wall for a couple of days) and I'd like to share it, but I'd be REALLY interested if someone can give me an explanation on why this happens.
The situation is simple enough : In C# 4.0, VS 2010 (haven't tested in other configs) create an empty ASP.NET web application
: File -> New -> Project (not Web Site) -> Web -> ASP.NET Empty Web Application.
In the newly created web app, create a page (add -> new item -> web form). Then run the project and, ofcourse, it works.
Now do the following :
Clean the project output i.e. delete everything from the bin folder
Change the project's output folder : project properties -> build -> output path. E.g. change bin\ to bin\debug (that's what I did)
BANG ! The project no longer works ! Try starting it (F5) and you 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 load type 'WebApplication2.WebForm1'.
Source Error:
Line 1: <%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: /WebForm1.aspx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
If you don't do step #1 (delete everything from the bin folder) the project works but when you change the code inside WebForm1.aspx.cs you start getting "Source file not found" messages from the debugger. As I understand, for some %$&^#$^* reason, it still uses dlls from the bin folder.
It looks like the output folder is hard-coded somewhere... ?! Does anyone have any idea on why on earth does this happen ?????
I know it's too late, but if somebody else is looking for this.
I had the same issue and what I found that bin folder was not included in the project. Include bin folder in the project, build it and it should be fine.
The project no longer works
Hmm well that's not quite right. The project is fine. VS is dutifully creating the dlls where you want them to. Its just not where you should be creating the folder.
What you're really asking is why won't ASP.NET load a dll from a random sub folder of bin. There are only a few locations that ASP.NET will look for assemblies. Aside from the bin there also the GAC and the .net Framework folder (but I suspect that's only for .net Assemblies). I don't know why but I suspect its to remove the need for you to tell it where to find it (Ala registry settings)
You could create your own Assembly loader but you'd need a way to communicate to your loader where the files are. You'd also probably need to put that assembly loader assembly in the bin.
Save yourself some grief and put the dlls in the bin folder so that ASP.NET will load them
As a side you note you may ask yourself what's this output directory for. The typical use case is libraries that are referenced by other assemblies. Also executable files can be put anywhere since they are the entry point rather than ASP.NET
What I did was just delete all of the .dll files from your project(\bin;\debug;\Release)
added a new item (which page to test) to the project and tried it in new page.
It works. Then, set the start page to the problem page which caused the error and try again, it works this time.
As a warning: This can also happen if your Web.config's configuration/system.web/compilation/assemblies gets messed up, especially if you add a <clear /> and IIS can't find some important assemblies.
Although not directly related to your scenario, this error can also come due to the ASP.NET runtime being unable to locate the /bin folder.
For this, make sure you have marked the virtual directory containing your application as a web application root.
e.g.
In godaddy web hosting you should mark Set Application Root to the folder/sub-folder containing your application. Making it a virtual directory is not enough.
Hope it will help someone.
This started as Could not load type 'Global' error. After I tried a few things and getting no where I deleted the Global.asax file and now the error is Could not load type '[namespace].???'
Where ??? is the class name of every page I try to load
The web site (when executed within VS2008, local dev computer) works fine but once published (with no errors) and deployed to the server gives me Could not load type '[namespace].???' error
I did install elmah and I was able to get more details for this "generic" Could not load type '[namespace].???' error
elmah reports a HTTP error 500 :
System.Web.HttpException Could not load type '[namespace].???' ->
System.Web.HttpParseException: Could not load type '[namespace].???'
Any ideas?
I have checked the "basics"
References
Doing a clean and a build
Checking the Inherits attr in the HTML against the code behind
UPDATE #1
I did deploy the site to a different DEV computer (configured IIS, virtual folder, etc.) and it works. When I use the same published code on the server, get the generic Could not load type '[namespace].???' error
UPDATE #2
I created a test web app. One form (Default.aspx) with a button. The click event does a Response.Write("Hello World"); I moved this app to the server and guess what, I get the Could not load type TestSite._Default
UPDATE #3
According to the fusion log viewer, these two websites are attempting to load CppCodeProvider and VJSharpCodeProvider, but I have no references to any of these. After a Google search, I found this post
I checked and I have no references to JAVA files. Still don't know what the problem is
Strangely enough, sometimes we get this error when the disk is full.
Make sure the project file is uploaded to the build server along with the added files. VS will add lines to this file that points to the new files location.
<Content Include="xxx.aspx" />
<Compile Include="xxx.aspx.cs">
<DependentUpon>xxx.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
Without the updated project file it will not find the code behind.
Really weird, maybe you should try to test it in a different server, this happens for example when you are using in you dev environment some namespaces from .NET 4.5 and you haven't installed the same framework in your server, so maybe the error is related to this behavior, if you are not using any third dll in your web application outside Microsoft's framework, so should try to reinstall the framework, I don't think the problem is related to visual studio.
I have created a new VS2008 ASP.Net Web service project, with the default name WebService1. If I right click on the Service1.asmx file and select 'View in Browser' what are the processes that go on to make this happen? I am asking because I have a situation where when I run this from a visual studio project started in our development shell (which sets up a common build environment) I cannot get the web service to show up in the browser.
It starts the asp.net development server and creates a single file:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\c43ddc22\268ae91b\hash\hash.web
but when I start it from a stand alone project i get a whole slew of files in here:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\edad4eee\d198cf0e\App_Web_defaultwsdlhelpgenerator.aspx.cdcab7d2.vicgkf94.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\edad4eee\d198cf0e\service1.asmx.cdcab7d2.compiled
etc etc
I am trying to debug this but not really getting anywhere. i have inspected the output from VS but the only option I get is for the build output, which is basic and doesn't really contain any information that is useful. I have tried running both versions with DebugView running but no output there either.
I would like to know if there are any log files I could look at, or if anyone has any suggestions on how I might be able to debug what is going wrong here?
For completeness the output I get when it doesn't work is:
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 'WebService1.Service1'.
Source Error:
Line 1:
Source File: /Service1.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Ok, not sure that its perfect but I found a resolution to this issue. the problems seems to be that the development shell redirects the <OutputPath> of the projects visual studio is building, and this was causing problems as, although the dependencies of the web service project were being copied into the $(ProjectDir)Bin\ directory, the actual webservice dll itself was not. The solution (workaround?) seems to be to add this to the post build event command line:
xcopy /y "$(TargetPath)" "$(ProjectDir)Bin\"
Then i am able to right click on the .asmx file and select view in browser and everything works as expected.
Hope this might help someone else in the future. or maybe even me in another place and time.