为什么在 SQL Server 中存储会话时没有出现错误?
我从 Sql Server 中的 .Net Framework 4.0 目录运行 InstallSqlState.sql。然后我使用以下方法配置 Sql 会话:
<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString = "data source=localhost; user id=sa; password="
cookieless="false" timeout="20" />
当我在 Session 中存储某些内容时,它可以工作!甚至 SessionId 也可以是 Session 对象中的会话。所以我很高兴,因为它没有任何错误就开始工作了。所以为了故意带来一些错误,我删除了这个
stateConnectionString = "tcpip=127.0.0.1:42424"
sqlConnectionString = "data source=localhost; user id=sa; password="
现在它所知道的是模式是SqlServer,但没有连接字符串,也没有用户名和密码。但它仍然有效!这怎么可能?我如何知道我的状态配置是否正确?无论我给出什么参数,它总是有效的。这里发生了什么以及如果我想查看 SQL Server 中特定用户会话的内容我应该做什么。
I ran InstallSqlState.sql from .Net Framework 4.0 directory in Sql Server. Then I configured Sql session using this:
<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString = "data source=localhost; user id=sa; password="
cookieless="false" timeout="20" />
When I store something in Session it works! Even SessionId can be session in Session object. So I became happy because without any error it started working. So to purposefully bring some error I removed this
stateConnectionString = "tcpip=127.0.0.1:42424"
sqlConnectionString = "data source=localhost; user id=sa; password="
Now all it knows is that the mode is SqlServer but no connection string and no username and password. But still it works! How is this possible? How can I know whether my state is configured properly or not? Whatever parameter I give it always works. What is happening here and what should I do if I want to see the contents of a particular user's session in SQL Server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的服务器是 localhost,您自己的机器,用作默认服务器。此外,当您未指定用户 ID/密码时,它默认使用 MS“可信连接”,当您在本地计算机上工作时,它会再次工作。
要创建错误,请更改 IP 地址或用户名/密码组合。
Your server is localhost, your own machine, which is used as the default server. Also when you specify no userid/password it defaults to using a MS "trusted connection", which again works as you work on your local machine.
To create an error either change the IP-address or the username/password combo.