Issue with the 'AspCompat' attribute - iis-7

One of my client's website (I didn't code it) was migrated to a new server yesterday by his host. All this aspx code that uses the aspcompat attribute now bombs -
<%# Page Language="VB" AspCompat="true" %>
'Next we need to create a database connection object on the server using the ADO Database connection object.
'Create an ADO connection object
adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using DSN connection
adoCon.Open ("DSN=Application")
So he's obviously using the old ADO objects and is banking on COM compatibility for it to work.
I tried setting up a new application pool at this folder level and set it to use the Classic pipeline but that didn't help either.
Short of rewriting all his ADO code to ADO.NET, what can I do to have him up and running? This is a production issue for him at this time, so time for him, is of the essence.
Thanks!

Obviously it's a server config issue, since it was a migration that caused the problem. With that in mind, here are some things to check:
.Net framework version (and service pack) used. Does it match the old server?
Check the web.config for anything tying it to the old server
Check the machine.config file
Check the trust level on the new server vs the old
Check file/security permissions on the new server vs the old
[update]:
I just came across this on google: http://forums.iis.net/t/994019.aspx

Related

Running asp classic page in ASP.NET application using oracle database

I am trying to debug one application which has mostly .aspx and .cs pages and the database behind it is an oracle SQL Developer database.
The whole application runs fine but it crashes on launching pages with .asp extension.
Below is the error:
"ADODB.Connection error '800a0e7a'
Provider cannot be found. It may not be properly installed.
After Googling I did enable ASP checkbox in Windows ADD/remove features.
Also, I tried changing Pipeline to classic and enabled 32-bit mode in the application pool of IIS server, but then the whole application stopped running in Visual Studio.
I had also created an odbc DNS driver in ODBCAD32.
Everything works fine but only crashes with .asp pages.
The error message says it all, ADODB cannot open database given in the connection string. Typically, classic asp must have the connection string somewhere in its code and it does not read the web.config file, which is for asp.net. To troubleshoot, open the source code of the failed asp page, find where it calls database, and check the connection string. It might happen that asp used "includes" and the connection string was defined in a different file, specified in <!--#include file="..."-->
Examples of connection string to Oracle can be seen here.

ASP.NET MVC Entity Framework application is using wrong SQL connection string

I have an ASP.NET MVC5 web application that was originally created using VS2013 and uses Entity Framework 6 Code First, with data migrations. It has been working fine (in production) for almost a year and has been re-deployed numerous times, from Visual Studio, using Web Deploy.
Today, I opened the solution in VS2015 and redeployed a known working version of the codebase to production without any problems. However, after deployment, the production website suffered from the problems described in this article, which I solved by applying author's the recommended fixes.
After applying these fixes, I now have a new problem: an exception that suggests that the application is trying to access the database using the wrong connection string:
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
Within the details of the exception page, the cause of the problem is clarified:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory.
I'm puzzled by this because the application has a dedicated SQL Server instance that is accessed using a regular connection string. I've checked the Web.config generated by Web Deploy and it seems to be intact. It contains a named connection string that correctly references the production SQL Server instance, and the code (which hasn't changed) correctly instantiates an Entity Framework ApplicationContext using the named connection string.
Does anyone have any idea why this application now expects to create its own SQL Server instance or what I can do to debug this problem?
Many thanks for your suggestions,
Tim
A few things you can try before making the web deploy:
Check if the project that contains the connection string declaration (web.config) is setted as the 'startup project'.
Rebuild the solution in release mode.
In the Publish Web wizard, in Settings, expand File Publishing Options and check 'Remove additional files at destination' and 'Exclude files from App_Data folder'

Previously working console app cannot update table in SQL Server after moving to new server

I just had to migrate a console app written by a previous developer to another server. It is supposed to update a table in a database that was migrated to the server at the same time. The app was working fine on the previous server, but does not update the table in the database on the new server.
I added a check in the app to make sure there wasn't an issue with the connectionstring and got no error. I have tried using Windows Authentication in the connectionstring and also setting up SQL Server Authentication and using that. I can also log into SQL Server directly with both sets of credentials.
I'm thinking it might be a permissions issue on the new server. Does anyone have any tips for how I can troubleshoot or resolve this issue?
if you have application code, then check for hidden exceptions (empty catch block). It may be the reason that the exception is not handled by developer.

Server Error in '/' Application

I'm learning ASP.Net and attempted to create a default ASP.Net project in VS2010 for the first time using VB.Net for the programming language.
After running the ASP.Net project, a default web page was displayed in a browser window. I tried to click on the LogIn link on the displayed web page and this error is displayed:
The user instance login flag is not supported on this version of SQL Server
We are using SQL Server 2012 Enterprise. We also have IIS7 installed in Window7. We have SQL Server, Visual Studio 2010 and IIS7 installed on the same computer.
I'm assuming a new database needs to be created but I don't know the details on what this database looks like or if there is a script that can be run that creates it.
All help will be appreciated.
The connection string for that application probably has User Instance=true set, which is only valid for SQL Server Express. You should remove that part from the connection string.
SQL Server 2012 no longer has user instances, instead opting for LocalDB.
Found out how to do it.
I changed the connection string to look like this:
connectionString="data source=.\SQLSERVER; Initial Catalog=aspnetdb;Integrated Security=True;"
The problem was being caused by:
AttachDBFilename=
It threw me off because I was assuming VS2010 would create the correct connection string.

Connecting to Oracle database

Today is my first day trying to use Oracle databases in Asp.NET so I have no idea of what I need to do.
I have added this code
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "Data Source=xxxxx;User Id=yyy;Password=psw;"
oOracleConn.Open()
Response.write("Connected to Oracle.")
oOracleConn.Close()
oOracleConn.Dispose()
End Sub
But it gives me the error
Type 'OracleConnection' is not defined.
Now i've had a look on the internet and it says that it may be the reference to the DLL that is missing?
I know I have got a DLL reference in my page and I don't think I even have the DLL anywhere on my server.
Where do I get this DLL from?
I've downloaded the ODBC .NET data provider but this didn't seem to help.
I've tried to add a reference in Visual Studio but I can't find the Oracle client reference in the list.
Any ideas?
Thanks
The Oracle recommended method is to use the Oracle Data Provider for .NET
You'll need an Oracle Client that is compatible with the version of the database you are using installed on your dev machine and the web sever machine.
There are some quirks with how you have to specify the database connection string. Some kind internet soul has documented the database connection strings for the oracle providers.
The oracle client has a file, called TNSNAMES.ORA, which is typically located in the /NETWORK/ADMIN folder under the oracle home where the client was installed (the installation location varies by version and installation settings).
This file contains a list of databases with the Port Number, Hostname, and Oracle SID which allows the oracle client to make a connection to a server.
Once all of this is configured (or you decide to use the "TNS-less" connection string), you should be able to make database connections to oracle.
The ODP.NET provider documentation also provides some sample code which is very helpful when getting started with it.
Per this, this OracleConnection is an obsolete API, however the DLL being used is:
System.Data.OracleClient.dll
EDIT: This article provides some data on different API's to connect to Oracle with .NET
The real problem is data type mapping,but not connection or provider .

Resources