Error in Stacktrace References Old Code - c#

I am attempting to publish my website to a intranet file server, but for some unknown reason a portion of the application seems to be referencing an old version of a class object. The class initializer is throwing an error stating that a stored procedure cannot be found. I know this is old code because that stored procedure no longer exists.
The error:
Could not find stored procedure 'stp_EMS_BM_EmployeeMovements'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Could not find
stored procedure 'stp_EMS_BM_EmployeeMovements'.
The web application runs perfectly on my local machine. I am currently publishing to the file server using Visual Studio 2015 Enterprise.
I have manually deleted all the files on the file server, rebuilt and published the project numerous times. Any recommendations on what to try next would be incredibly helpful.

It appears that some dependency was not fully updated on your website as it had been on your local server. To find what is different, here are two suggestions.
1) Use WinDiff on all your files, including .dll & .exe files. Some old files could have received a new modification date without being modified. WinDiff should show what files are different in these two environments.
2) Compare the file version numbers of like files in the two environments. If the file version was revised with your latest changes, this too will show what files are different in these two environments.

Related

Asp publish website with Sqlite

first of all I'm a total newbie with Asp.net. On the other hand I use C# everyday.
So what I have to do is a fairly easy matter except for the fact that I don't know Asp.Net.
I am require to make a simple form that gathers data in a Sqlite database.
I am using VS2008 and the latest version of Sqlite.
Everything works fine when working locally (I can run the website and add data to the s3db db).
The problems are coming out when it comes to publishing. At the moment I am publishing ON MY FILE SYSTEM accordin to procedure Walkthrough: Deploying a Web Site Project by Using the Publish Web Site Tool
so when it comes to the paragraph Testing the published Website (published in the folder C:\CompiledWebSite so the local address is http://localhost/CompiledSite/Default.aspx) I get the error:
Server Error in '/CompiledSite' Application.
Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format.
which I didn't get when running it from VS2008.
So all what comes to my mind is that it's not a matter of Sqlite format but a problem related to the fact that it doesn't find the .s3db file which in the end there isn't in the folder C:\CompiledSite.
But I added it to the solution! And I can see it in the solution explorer structure.
I think that all problems come from my being totally unaware of how asp works but I have to find a solution!
can anybody help me?
thanx in advance!
I found it!!!
from
http://www.codeproject.com/Articles/548421/Anplusattemptpluswasplusmadeplustoplusloadplusaplu
it says to go to IIS and set Application Pools --> Advanced Settings --> Set "Enabled 32-Bit Application" to True and press OK
that worked!!

Azure Error Referencing Local Path

I've got a web app deployed on Azure and I'm getting an error on the Azure deployment that shows the reference to a class library in the same solution.
But the error message shows a file path on my local:
Object reference not set to an instance of an object.
XXX.Domain.Concrete.EFBusinessRepository.PrepForConversionToHtml(XXX x) in c:\dev\repos\Jeff\ClassLibrary\Concrete\EFBusinessRepository.cs:1280
and not one more typical to Azure:
Object reference not set to an instance of an object.
XXX.Domain.Concrete.EFBusinessRepository.PrepForConversionToHtml(XXX x) in
E:\sitesroot\0\bin.....
Am I overreacting on this? It just seems dumb that it's showing a path on my local. I'm in the midst of tracking down all of the errors of a new Azure deployment, so apologies if this is expected behavior.
Adding in the resolution as answer here.
The pdb files contain additional debug information wrt your binaries. Any failures that show up on a machine with pdbs deployed will show a richer stack information referring back to the source code files with line numbers etc. Deleting out the pdbs will resolve your issue. Plus you ideally should not be deploying pdbs with your retail product bits unless you are actively debugging something in production.

Error "object is currently in use elsewhere" TFS GetLatest

We have our code available in TFS. When we take code in one machine (in a different location) it throws an error "object is currently in use elsewhere". Also one of the C# files is not getting downloaded. When we try to build it says "Source file 'filename' could not be opened ('Unspecified error')
This is not reproduced in other locations. Any idea what could be the issue?
Note: It is an asp.net website. We have used enterprise library. Also there is a chart control.
Note: We are using VS 2010.
I have read the following. But thge difference here is that the error is coming as and when we are taking latest from TFS. Is the TFS doing a build while taking latest itself?
InvalidOperationException - object is currently in use elsewhere - red cross
also
Error : Object is currently in use elsewhere.
If project solution name or some files have unique characters in names or some variable names in code other than basic latin letters, then sometimes moving the project would give these errors.
The first error seems like you are using some unmanaged code in your code base, so you would need to get the code in here which might help in why this is caused.
The second case is of the file being deleted from the repository and that .proj file on your machine has not been updated, so it complains of the missing file, you may have to remove it from your project for it to work. one of the file is not getting downloaded coz its not there in the repository at all

Error when publishing .NET c# application

It has been two days and I haven't been able to make this application work in the hosting computer. This application is in a subdirectory and is written in C# the other application is C#. It work just fine down here in my development computer. I have been trying the following.
1.I made the changes to the web.config so it doesn't conflict.
(seems to be fine)
When I created the application was created with Version 3.5. I downgrade to 2.0
I have been recompiling, being sure that the .aspx file and the .cs file it's under the directory.
Waht Am I missing.
Any ADVISE/Comments or questions please let me know. This is frustrating. Below is the link and the error I get
http://www.martinesexpress-inc.com/PhoneControl/Default.aspx
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 'ElLogPh._Default'.
Source Error:
Line 1: <%# Page Language="C#"
AutoEventWireup="true"
CodeBehind="Default.aspx.cs"
Inherits="ElLogPh._Default" %> Line 2:
Line 3:
Source File: /PhoneControl/Default.aspx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET
Version:2.0.50727.3053
You're publishing to a sub directory (PhoneControl) of the application root (http://www.martinesexpress-inc.com/). If PhoneControl is not an application in IIS, then it will won't look for assemblies in http://www.martinesexpress-inc.com/PhoneControl/bin but http://www.martinesexpress-inc.com/bin.
Basically, in a nutshell, the dll that is compiled for you (and comtains the class 'ElLogPh._Default') is not being found. There are a few reasons for this to be the case, but here is the first that comes to mind, and the most likely:
The first question is, are you aware of how a Visual Studio web site project corresponds with an IIS application? This is incomplete, but the simplest description of the first thought that comes o mind.
When you create a web site project in Visual Studio and Build it (or publish it, since VS's publish process includes building it first) all of the code behind is compiled into dll's that are put in to the "bin" directory.
When you publish this out to the web site, an IIS application has one and only one bin directory. Any bin directories in nested folders are not treated as actual bin directories.
So, if you built this as a different project and just copied it into the original folder, your structure would look like this:
\Parent
\Parent\Bin
\Parent\YourNewApp\
\Parent\YourNewApp\Bin
I'm thinking that the ElLogPh._Default class is in a dll inside of \Parent\YourNewApp\Bin.
The resolution to this would be to go to the IIS manager and make \Parent\YourNewApp an application.
If it sounds like I'm on the right path, instructions for creating an application in IIS are found here: http://www.affiliatewiz.com/support/appstartpoint.asp
I don't know if this will help, but are you building in Release mode?

Publishing Website fails for some pages

I have a strange problem when I publish my website. I inherited this project and the problem started before I arrived so I don't know what conditions lead to the creation of the problem.
Basically, 3 folders below the website project fail to publish properly. When the PrecompiledWeb is transferred to the host these three folders have to be manually copied from the Visual Studio project (i.e. they are no longer the published versions) to the host for it to work.
If the results of the publish operation are left, any page in the folder results in the following error:
Server Error in '/' Application.
Unable to cast object of type
'System.Web.Compilation.BuildResultNoCompilePage'
to type
'System.Web.Compilation.BuildResultCompiledType'.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.InvalidCastException: Unable to
cast object of type
'System.Web.Compilation.BuildResultNoCompilePage'
to type
'System.Web.Compilation.BuildResultCompiledType'.
Source Error:
An unhandled exception was generated
during the execution of the current
web request. Information regarding the
origin and location of the exception
can be identified using the exception
stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast
object of type
'System.Web.Compilation.BuildResultNoCompilePage'
to type
'System.Web.Compilation.BuildResultCompiledType'.]
System.Web.UI.PageParser.GetCompiledPageInstance(VirtualPath
virtualPath, String inputFile,
HttpContext context) +254
System.Web.UI.PageParser.GetCompiledPageInstance(String
virtualPath, String inputFile,
HttpContext context) +171
URLRewrite.URLRewriter.ProcessRequest(HttpContext
context) +2183
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+405 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
+65
Version Information: Microsoft .NET
Framework Version:2.0.50727.832;
ASP.NET Version:2.0.50727.832
Does anyone have any idea what the possible causes of these pages not publishing correctly could be? Anything I can look at that may indicate the root of the problem?
Addition:
It is a completely clean build each time, so there shouldn't be a problem with old bin files lying around. I've also checked the datestamp on the items in the bin folder and they are up-to-date.
Second Addition:
The project was originally created as a Web Site, not a Web Application. Sorry for the ambiguity.
You might look into trying Microsoft's Web Deployment Projects. They give you much more control over MSBuild, essentially, but it might help solve your deployment/pre-compiling woes.
Are we to infer you are using a Web Site project type (and not Web Application)?
Im guessing that because when you publish, it is compiling your Web Site project and it is hitting a duplicate class name somewhere across different folders or sub folders. Make sure you check your inherit tags and class names so that you dont call 2 classes the same thing. This is fine and wont error when it happens in different folders when coding and debugging, but when you go to publish / deploy it will error. ... Hope that makes sense.
I would try cleaning the bin\ folder.
In any case our shop completely dropped websites in favour of web form applications, which are arguably far better.
EDIT: Migration HOW TO here
I had a similar problem a while back, where the publish would say it was successful, but the publish folder remained empty.
Besides looking at the Web Deployment Projects you should also set the verbosity to Diagnostic (Tools=> Options=>Project and Solutions =>Build and Run=> Msbuild project build output verbosity)
This, in my case had the effect of displaying meaningful compiler errors that helped me resolve the issue.
You could then also run the aspnet_compiler with the -errorstack directive in the shell prompt to display additional errors.
The best answer for this please open you web.config file and add below two setting add in the compilation tag
<compilation targetFramework="4.0" debug="false" batch="false">
Keep coidng, Also i tried following things when i get the same error in my application which i tried to host in the server
1.Click Start, click Run, type iisreset /stop, and then click OK.
2.Open the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files directory.
3.Delete all files and all folders in the directory that you located in step
4.Click Start, click Run, type iisreset /start, and then click OK.
5.Do a build again and then try to access your site.

Categories

Resources