Impersonation error connecting from Outlook 2016 x64 - iis-7

When connecting to an IIS 7 website from an Outlook Addon, appear this error:
An anonymous identity cannot perform an impersonation.
The impersonation is invoked inside the website:
System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =((System.Security.Principal.WindowsIdentity)System.Web.HttpContext.Current.User.Identity).Impersonate();
Oddly, it is working from Outlook 2010-2013 x32, but not from Outlook 2016 x64.
Same code is working in another IIS server (with the difference that Exchange is installed on the server). WebServer roles and IIS config seems to be the same in both servers (Windows Server 2008).
Any idea?

Related

Configure windows Authentication in IIS 8.5 on Windows Server 2012

I searched enough but couldn't find a solution. I have a ASP.NET Intranet app at Windows Server 2008 IIS 7.5 with windows authentication - this all work great.
I have been trying to migrate it to Windows Server 2012. I have already installed Windows Authentication role for the server and already enabled the windows authentication for the web site.
The application seems to be working fine for my account but if anybody else try to connect they get windows login popup.
I was having similar issues. I wrote up this answer:
How to enable Windows Authentication on a Windows Server 2012 IIS website using Powershell?
Short answer is:
Ensure you have Web-Windows-Auth installed
Ensure Set-WebConfigurationProperty has been set for Windows Authentication (and I turned off Anonymous Authentication too)
Ensure your Web.Config is properly setup
The biggest difference is IIS has turned this off by default, and you have to explicitly enable it to use it, even though your Web.Config is configured correctly.

"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 ?

"Provider cannot be found. It may not be properly installed" using ORAOLEDB, IIS7, 32bit app, 64bit o/s

I have a classic ASP application which I've moved from a Windows 2003 server running IIS6.0 to 64-bit Windows 2008 R2 running IIS7. In IIS7 I've created a website and added an application to that and have set the application pool to enable 32-bit applications.
The application connects to an Oracle database using the ORAOLEDB driver - I've installed the 64-bit Oracle client 11.2.0.3 to connect to the backend Oracle 11g database and can connect fine via the same user as the application using SQLPlus.
When I run the application though, its attempt to connect to Oracle fails with the IIS logs showing the error:
"Provider cannot be found. It may not be properly installed"
I've tried various possible things to try and get this working:
registering OraOLEDB11.dll manually
disabling 32-bit applications from the app pool
using the 32-bit drivers instead both with 32-bits apps enabled and disabled
reinstalling the drivers completely and trying all the above
So far without any luck. The asp code connects as follows:
objOracleConnection.CursorLocation = adUseClient
objOracleConnection.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=MYDATASOURCE;User ID=USER;Password=PASSWORD;PLSQLRSet=1;OLE DB Services=-2;"
objOracleConnection.Open
EDIT: I've tried a simple VBS script (using essentially the same code as above) to connect and it gets the same error, so IIS may not be the problem. The exact same script works on the Windows 2003 box however.
I've reinstalled the Oracle client via the 'Troubleshoot Compatibility' option, indicating that the application works under Windows 2003 SP1 but still get the same issue from both the VBS script and the IIS application :(
This is an educated guess, but enabling 32 bit applications in IIS7 seems to disable 64 bit applications. If it's a 64 bit driver you may need to disable 32 bit in your app pool

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.

User.IsInRole fails when using VS 2008's debugging web server on Windows 7 using Windows Auth

When the following line is called when running a website from the VS2008's web server i get a "The trust relationship between this workstation and the primary domain failed." exception.
if (User.IsInRole("SomeRole"))
...
I have turned UAC off, and set VS 2008, and it's built-in webserver, to run as an Administrator, and i have also rejoined my box to the domain. This code works fine if called from one of my Server 2003 boxes in IIS, and it always worked fine in Vista.
Any ideas on what may be causing this?
EDIT:
I just tried running it in IIS 7.5 on my local machine and i am getting the same error. Running it on Windows XP in IIS 5.1 and in the VS 2008 webserver works.
Have you tried running VS2008 as administrator?
This was a Win7/Server2008 R2 bug. The error only occurred when connected to a Windows 2000 domain.
Hotfix available from here
The built in web server is cassini, which is a rather limited web server. You may have discovered a feature cassini doesn't have-- maybe it can't do kerberos. Here is more discussion about what Cassini doesn't have.

Resources