WCF Works On XP But Not Windows 7
I have a WCF service which is hosted in a WinForms application. This WCF service calls a COM component written in ATL on Visual Studio 6. This works just fine on Windows XP. However the COM component fails on Windows 7 when calling GetFileAttributes. It says the path does not exist even though it does. It is a mapped network drive. The only reason I can think of for this is that The WinForms 开发者_开发知识库app which hosts the WCF service has to right clicked and Run As Administrator. I am then assuming the COM component effectively gets the same raised priveleges and therefore the mapped drive which existed under the user logged in to the machine no longer exists as far as the application is concerned.
Is this a valid assumption and if so what are my options for solving this?
On Windows 7 (and equivalents) you loose mapped drives when you run as administrator. That's because you basically switch to another login token, and the network drives are mapped only to the non-admin's.
There are a few ways to overcome this, see discussions here and here.
Also, there's a registry setting (not mentioned on those links) that links the two tokens. See KB article about EnableLinkedConnections, a discussion about using it.
精彩评论