ASPNETCOMPILERERROR - object reference not set to an instance of object - asp.net

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.

Related

Using MemoryCache.Default in Module causes Error ASPPARSE: Circular file references are not allowed error during build

In an asp.net webform application project framework 4.7.2 with Option Infer On, including the line Dim cache = System.Runtime.Caching.MemoryCache.Default in a method, causes the Error ASPPARSE: Circular file references are not allowed in several aspx files (no obvious reason for why those files and not others that I can see) when building on our build server.
I don't have any unincluded files (I had an unincluded AssemblyInfo.vb file, I deleted it, no difference).
It's taken me quite a while to narrow it down to this, and I haven't been able to figure it out. Any solutions or suggestions welcome.

Error launching web application after installing it using InstallShield

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

asp.net error “The type 'typeName' exists in both ”temp1.dll“ and ”temp2.dll"

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.

What is the process involved in viewing a webservice in a browser from within 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.

Weird MethodNotFound exception when renaming a property - related to asp.net / web forms / fluentnhibernate and visual studio

I have a local website which I run through Visual Studio 2008's internal development web server (through the run / compile button).
I have an external library which is referenced on a page of that website and resides inside the web site's "bin" folder.
I've recently changed a class' property name inside that library (renaming it, from "ValidFrom" to "VisibleFrom"), recompiled its dll and have overwritten the original dll inside the bin folder.
This class is mapped with FluentNHibernate, I've also changed the mappings and recompiled / redeployed the library.
When I try to run the site and navigate to the page where the library is used, I'm getting a MethodNotFound exception for the method get_ValidFrom, related to FluentNHibernate's configuration call. This should be get_VisibleFrom now!
Now I've reconfigured my NHibernate SessionProvider so that it generates a new Configuration for NHibernate on each call, and does not retrieve it from the Http Session entity like it did before, because I figured there might lie the problem.
I'm still getting the exception however. I've then deleted the Temporary ASP.NET folder's content... but I'm still getting the error.
Where is the generated schema for NHibernate stored, when using FluentNHibernate?
Anyone knows where else this could somehow be cached?
Thanks
FNH does not cache the schema, it is generated on-the-fly when you make a call to Fluently.Configure() and the schema is passed directly into an NHibernate Configuration object which is used to build an ISessionFactory.
Try clearing out all compiled objects/libraries/executables, removing the reference to your library from all projects that use it, add it back in, and then re-compile everything. Also check your all your code for "magic strings" that may be referencing this property or causing it to be referenced by the old name.
If that doesn't work, it might be helpful to see a stack trace to get an idea of what is being called from where.

Resources