Наши рабочие станции не являются членами домена, на котором работает наш SQL Server. (Они вообще не находятся в домене - не спрашивайте).
Когда мы используем SSMS или что-либо для подключения к SQL Server, мы используем RUNAS/NETONLY с DOMAIN\user. Затем мы вводим пароль и запускаем программу. (RUNAS/NETONLY не позволяет включать пароль в пакетный файл).
Итак, у меня есть приложение .NET WinForms, для которого требуется соединение SQL, и пользователи должны запустить его, запустив командный файл с командной строкой RUNAS/NETONLY, а затем запускает EXE.
Если пользователь случайно запускает EXE напрямую, он не может подключиться к SQL Server.
Щелчок правой кнопкой мыши по приложению и использование параметра "Запуск от имени" не работает (предположительно, потому что рабочая станция действительно не знает о домене).
Я ищу способ, чтобы приложение выполняло внутренние функции RUNAS/NETONLY, прежде чем оно начало что-либо значимое.
См. эту ссылку для описания работы RUNAS/NETONLY: http://www.eggheadcafe.com/conversation.aspx?messageid=32443204&threadid=32442982
Я думаю, что мне придется использовать LOGON_NETCREDENTIALS_ONLY
с CreateProcessWithLogonW