使用SSPI使用Npgsql连接到远程PostgreSQL服务器

使用SSPI使用Npgsql连接到远程PostgreSQL服务器,postgresql,nhibernate,windows-authentication,npgsql,sspi,Postgresql,Nhibernate,Windows Authentication,Npgsql,Sspi,我正在使用nHibernate+Npgsql通过windows身份验证(SSPI)连接到PostgreSQL server。我已经将windows用户添加到Postgres中,并按照建议配置了设置 这是我的连接字符串: “服务器=;端口=5432;数据库=;集成安全性=true” 这是我的代码: if (!sessionFactories.TryGetValue(sessionFactoryConfigPath, out sessionFactory)) {

我正在使用nHibernate+Npgsql通过windows身份验证(SSPI)连接到PostgreSQL server。我已经将windows用户添加到Postgres中,并按照建议配置了设置

这是我的连接字符串: “服务器=;端口=5432;数据库=;集成安全性=true”

这是我的代码:

if (!sessionFactories.TryGetValue(sessionFactoryConfigPath, out sessionFactory))
            {
                Configuration cfg = new Configuration();
                if (sessionFactoryConfigPath != DefaultConfigFile)
                {
                    //Check.Require(File.Exists(sessionFactoryConfigPath),
                    //    "The config file at '" + sessionFactoryConfigPath + "' could not be found");

                    cfg.Configure(sessionFactoryConfigPath);

                }
                else
                {
                    cfg.Configure();
                }


                //  Now that we have our Configuration object, create a new SessionFactory
                sessionFactory = cfg.BuildSessionFactory();
当我运行此命令时,在sessionFactory=cfg.BuildSessionFactory()处出现以下错误:; “致命:XX000:无法接受SSPI安全上下文”

当我检查PostgreSQL日志时,发现以下条目: “提供给函数的令牌无效(80090308)”

我使用的是PostgreSQL 93.2,由Visual C++构建1600,32位。我从postgres网站上得到的。我使用的是64位Windows7SP1


我错过了什么?请帮助。

你的PostgreSQL版本(<代码>选择版本())/代码>,加上你从哪里得到的信息,以及你的Windows版本。我使用的是PostgreSQL 93.2,VisualC++构建的1600,32位。我从postgres网站上得到的。我使用的是64位Windows 7 SP1。我不能完全确定SSPI auth是否在没有AD域的情况下工作。此外,PostgreSQL 9.2及以上版本默认作为
NETWORKSERVICE
运行,而不是
postgres
用户;因此,我怀疑这些说明已经过时了。问题是几乎没有人使用或谈论SSPI auth,Windows专家通常不会对社区或文档做出贡献,因此存在一点信息真空。