.net - Crystal Reports 中的模拟
问题描述
我一直在尝试更新与 Crystal Reports 交互的 WCF 项目,以使其通过 Windows 身份验证连接到 MS SQL Server。它是一个 WCF 项目,但作为 Windows 服务而不是通过 IIS 运行。
我正在使用SimpleImpersonation来执行模拟步骤。本质上,如果传入的 SOAP 请求中提供了正确的值,包括 IntegratedSecurity=true,它会模拟另一个用户并尝试使用 IntegratedSecurity 登录。
我的代码看起来像这样:
using (Impersonation.LogonUser(domain, username, password, LogonType.NewCredentials)) {
reportDocument.Execute();
}
我知道模拟是有效的,因为我System.Security.Principal.WindowsIdentity.GetCurrent().Name
在声明之前和之后都打印了,using
并且看到用户名在using
.
我已经尝试了每个不同LogonType
的 s,但我得到了相同的结果。
我Database logon failed
从调用中收到一条错误消息Execute()
。
但是,如果我以我试图模拟的帐户启动 Web 服务,我就能够正确连接到数据库。
我的问题是:
- 模拟是否按我的预期工作?难道我做错了什么?(根据文档,它看起来不像)
- .NET 的 Crystal Reports 运行时是否有我需要以不同方式配置的东西?
解决方案
事实证明,我的问题不在于模仿,而在于数据库驱动程序。我在https://archive.sap.com/discussions/thread/3621859上找到了一条评论:
请检查服务器中是否存在“sqlncli.dll”文件?..不确定这个文件或其他一些dll。
我在服务器上安装了https://www.microsoft.com/en-us/download/confirmation.aspx?id=50402并且我的代码开始自动运行。
我希望从 Crystal Reports 返回的错误消息更具描述性,但是哦,好吧,至少它可以正常工作。
推荐阅读
- phpmyadmin - phpMyAdmin 错误 phpMyAdmin - 错误 缺少 mysqli 扩展。IIS 窗口 7
- spring-boot - 单核细胞增多症
-> 如何返回 ResponseEntity.NOT_FOUND? - javascript - 在输入字段 ReactJS 中添加按钮
- apache-kafka-connect - Kafka HDFS Sink 连接器重启
- python - 从 Python 中的 Dictionary 打印特定键的值
- laravel - Laravel JSON 响应错误处理不起作用
- apache - 通过 .htaccess 从 URL 中删除双斜杠的问题
- typescript - 在嵌套对象中使用 firestore 的 FieldPath.documentId()
- javascript - React:在渲染函数中获取函数的返回值
- reactjs - 单击链接时滚动到页面一部分的React.js Header?