Can not access registry over IIS7.5 on Win2K8 R2 web - asp.net

I wrote a Web service in ASP.NET using Microsoft Sync Framework 2.1 and SQL CE 3.5 SP2.
On development system (Win7) everything works fine.
After publishing on a server with Win2k8 R2 Web synchronization throws an error : System.UnauthorizedAccessException because it can't
access :
"HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server Compact Edition\v3.5"
Stacktrace:
Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistrySecurity registrySecurity)
Microsoft.Synchronization.Data.SqlServerCe.SqlCeSyncUtil.CreateMachineID()
Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.CreateSyncSubscription(Guid serverId)
Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.get_ClientId()
Microsoft.Synchronization.SyncAgent.GetClientInfo()
Microsoft.Synchronization.SyncAgent.DataSynchronize()
How can I fix that problem without running into security issues?
Thx

set the ClientId property on the client provider (SqlCeClientSyncProvider) in your client application.

Related

Using Active Directory Authentication for Azure SQL server in .Net Core App 1.1

I want to connect to my Azure SQL server using Azure Active Directory Authentication in a .Net Core App 1.1 .
On using a connection string similar to the following connection string:
Data Source=n9lxnyuzhv.database.windows.net; Authentication=Active Directory Integrated; Initial Catalog=testdb;
I get this exception:
System.ArgumentException: 'Keyword not supported: 'authentication'.'
I understand that AAD Auth is available for SQL servers in .Net Framework 4.6 and above. Is it possible to connect to server through AAD in .Net Core Apps. If so, how?
Any help is appreciated.
For now, .Net Core does not support for Microsoft Active Directory Authentication Library for Microsoft SQL Server. Please refer to this feedback.
With the Active Directory Admin set for the Azure SQL Server you are able to login to the SQL server with SQL Server Management Studio. On all client machines, from which your applications or users connect to Azure SQL Database or Azure SQL Data Warehouse using Azure Active Directory users / applications, you must install the following software:
.NET Framework 4.6 or later
Azure Active Directory Authentication Library for SQL Server
(ADALSQL.DLL) is available in multiple languages (both x86 and amd64)
This blog maybe helpful.

.NET 2.0 and Classic ASP running on Windows Server 2012

I really hope someone can help out. We are in the process of migrating all of our web applications to a new hosting environment.
Most of the applications are .NET 4 / 4.5. However we have a few running .NET and one running classic ASP.
On all the sites running .NET 2.0 we are getting:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
The connection string points to the DB server by IP address - not name.
I'm also getting a 500 error on the classic ASP - but I am still working on the specific error. My suspicion is they are the same - mainly because it takes 30 seconds for both apps (classic ASP / .NET 2.0) to render the error page.
The new environment is Server 2012. They are coming from a server 2008 environment.
Is there something about IIS 8.5 that needs to be set-up to all the db access on older framework apps?

"ORA-03134: Connections to this server version are no longer supported."

I am trying to understand why the same C# Oracle access code works under VS2010 environment but not under IIS.
I am building a web service to access Oracle 9.2 database on the remote machine. The web service must be hosted in the IIS under Windows 2003 machine. The same machine is hosting Oracle 9.2 database.
The web service must be compiled for x86 CPU because of Windows 2003 that is 32-bit architecture.
My Visual Studio project is WCF Application.
When I run the service under ASP.NET Development Server everything works fine. The database is connected and all CRUD operations are possible.
When I deploy everything under IIS on my machine or any other machine the I am getting "ORA-03134: Connections to this server version are no longer supported." at the time of connecting.
I supposed it is some kind of permission problem so I run the service under special Application Pool with LocalSystem account. I even gave to the Oracle client folder installed on my machine Full Control permissions for IIS users but this should not be needed because of LocalSystem account.
Anyway I tried and nothing. It is always the same error.
What could be the reason ?

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. TCP provider, error: 0

I always get the above error when trying to connect to a SQL server 2000 database hosted on a "server" with Windows XP pro. The client pc (my working environment) is Windows 7.
Up to now I have developed my application using Visual Studio 2010 and Net framework 4.0.
All was working correctly. Then I have installed Visual Studio Express 2012 for Web and ASP.NET 4.5.
Now, when i try to connect via SqlConnection conConnection .Open() i get the Exception:
A connection was successfully established with the server,
but then an error occurred during the pre-login handshake.
(provider: TCP Provider, error: 0 -
An existing connection was forcibly closed by the remote host.)
Please note the second message, because I have found very little info on that: An existing connection was forcibly closed by the remote host.
I have yet unsuccessfully tried a myriad solutions, including:
Various connection strings (Encrypt=false; )
netsh WinSock Show Catalog > winsocks.txt (don't seem to spot any strange application here)
netsh Winsock reset on both client and server
Rebuilding the app from Visual Studio targeting Net 4.0 / Net 4.5
Use Visual Studio Development Server or Local IIS Web Server
IIS reset, restarting Client and Server pc variuos times
Checked the SQL Server 2000 properties, connections, logs, profiler...
What other could I try next without disinstalling Net 4.5 (and Visual Studio 2012)?
Important additional info
This same application is deployed in a production server (Windows 7, IIS 7.5, Net framework 4.0).
The application actually in production was compiled with Visual Studio 2010, net 4.0, and is connecting correctly with no errors (thankfully)!
So, the problem has arisen on my client machine after I have installed VS Express 2012 and Asp.net 4.5. (I have also tried to open and recompile the solution with VS2010, but I get the same exception).
EDIT
For testing purpose, I have deployed my application, compiled with VS 2012 / Net 4.0, to the "production" server (on which I have never installed Net 4.5 of course).
For this I have created a new Web Site, with Application pool set to Integrated pipeline and targeting Net Framework v4.0.30319.
Now, this test web site connect successfully to my test SQL Server database (SQL 2000) and also to my production server database (SQL7).
Clue:
the problem resides only on my client pc, and the culprit is Net 4.5?
EDIT 2
Connecting via Visual Studio 2010 or 2012 Server Explorer, Data Source: Microsoft SQL Server (SqlClient) gives the same Exception (only difference is that now is pre-login handshake timeout).
Instead Connecting from Microsoft SQL Server Management Studio 2008 works fine! (Server type: Database engine; Server name: myserver\SQL2000; Authentication: SQL Server Auth; Login: Password)
How can be that the connection from SQL Server Management Studio works fine?
Did you uninstall VS 2012 to "fix" this issue? Why can't you install .NET 4.5 on the server or copy the DLLs to the server per Marc Gravell's post at http://marcgravell.blogspot.co.nz/2012/09/iterator-blocks-missing-methods-and-net.html?
I am essentially having the same problem. ASP.NET Project that runs successfully on a Win 7 computer in visual studio 2010 but moved to a Windows 8 box running Visual Studio 2012. Project is converted by VS when running it throws the SQL server error message described above. SQL server is remote but both clients (Win 7 and Win 8) are local on the same network. One works and the other doesn't.
Comparing setup on both machines in IIS I found that there is a difference between the configuration of the Application Pool in use by the web application. The Identity property defaults to "ApplicationPoolIdentity" but if you change it to "NetworkService" then the problem is resolved. Hopefully this will help someone else as I have done an extensive search and found nothing that pointed to this.

SQL 2008 + IIS Application Pool: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path

I´m having trouble connecting to SQL Server 2008 R2 Express with Northwind database using ApplicationPoolIdentity in IIS 7.5, resulting in the following error message:
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. The connection will be closed.
notes:
I´m using Windows 7/VS 2010/IIS 7.5/SQL Server 2008 R2 Express (all in the same machine).
my site is using "ASP.NET v4.0" application pool;
ASP.NET v4.0 application pool is using ApplicationPoolIdentity as Identity;
the SQL Server 2008 R2 express has the Login "IIS APPPOOL\ASP.NETv4.0" with the server role sysadmin granted;
the Northwind database has the user "IIS APPPOOL\ASP.NET v4.0" configured with the following permitions: db_accessadmin, db_backupoperator, db_datareader, db_datawriter, db_ddladmin, db_securityadmin;
the w3wp.exe process is running with the user "IIS APPPOOL\ASP.NETv4.0"
I can see that the user profile folder is created (C:\Users\ASP.NET v4.0);
the same problem occurs using the application pool "DefaultAppPool".
If I change the ApplicationPoolIdentity user to another user that has rights to access the database it works.
Additional informations:
connection string:
<connectionStrings>
<add name="NorthwindEntities" connectionString="metadata=res://*/NorthwindModel.csdl|res://*/NorthwindModel.ssdl|res://*/NorthwindModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=NOTEBOOK\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
Could anyone help me to solve this issue?
Thanks in advice.
It looks like you're trying to use SQL Server Express's "user instancing" feature, i.e. your connection string looks like:
AttachDBFilename=|DataDirectory|xxxxxx.mdf;User Instance=true
This won't work for ApplicationPoolIdentity accounts in IIS7.5. For more information see this MS Knowledgebase article:
Problems with SQL Server Express user instancing and ASP.net Web Application Projects
Web applications built with Visual Studio 2005, Visual Studio 2008, or
Visual Studio 2010 and that rely on user instancing with either SQL
Server Express 2005 or SQL Server Express 2008 do not work with the
new application pool identity. These products were developed and
tested against application pools running with the older NETWORK
SERVICE account.
Also Microsoft discourage using this feature now:
This feature will be removed in a future version of Microsoft SQL
Server. Avoid using this feature in new development work, and plan to
modify applications that currently use this feature.
If you've not already done so, I would attach the database to SQL Express and use a regular SQL connection string instead, just like you'd do in a production environment. You may need to enable TCP/IP for your SQL Express instance using the SQL Server Configuration Manager if it's not already enabled:
And ensure that port 1433 is configured as well on the next tab of that dialogue.

Resources