Trusted_Connect......
Trusted_Connection=true;
这就意味着连接将采用信任连接方式,但由于连接前没有用Windows组帐号(在ASP环境中是访问IIS服务帐号IUSR_计算机名,在ASP.NET环境中帐号是ASPNET)登录至SQL Server服务器, 也就是说没有建立一个信任连接(Trusted connection),当然,SQL Server连接也不能够成功。
defalut采用aspnet, 可以在machine.config中配置 processModel 中的userName="machine", 需要重启iis或netFramework(具体不知, 我想应该是framework, winForm的程序怎么办呢), 重新load machine.config, 当然了,最好是reset your computer, 嘿嘿!
<!--
processModel Attributes:
enable="[true|false]" - Enable processModel
timeout="[Infinite | HH:MM:SS] - Total life of process, once expired process is shutdown and a new process is created
idleTimeout="[Infinite | HH:MM:SS]" - Total idle life of process, once expired process is automatically shutdown
shutdownTimeout="[Infinite | HH:MM:SS]" - Time process is given to shutdown gracefully before being killed
requestLimit="[Infinite | number]" - Total number of requests to serve before process is shutdown
requestQueueLimit="[Infinite | number]" - Number of queued requests allowed before process is shutdown
restartQueueLimit="[Infinite | number]" - Number of requests kept in queue while process is restarting
memoryLimit="[number]" - Represents percentage of physical memory process is allowed to use before process is recycled
webGarden="[true|false]" - Determines whether a process should be affinitized with a particular CPU
cpuMask="[bit mask]" - Controls number of available CPUs available for ASP.NET processes (webGarden must be set to true)
userName="[user]" - Windows user to run the process as.
Special users: "SYSTEM": run as localsystem (high privilege admin) account.
"machine": run as low privilege user account named "ASPNET".
Other users: If domain is not specified, current machine name is assumed to be the domain name.
password="[AutoGenerate | password]" - Password of windows user. For special users (SYSTEM and machine), specify "AutoGenerate".
logLevel="[All|None|Errors]" - Event types logged to the event log
clientConnectedCheck="[HH:MM:SS]" - Time a request is left in the queue before ASP.NET does a client connected check
comAuthenticationLevel="[Default|None|Connect|Call|Pkt|PktIntegrity|PktPrivacy]" - Level of authentication for DCOM security
comImpersonationLevel="[Default|Anonymous|Identify|Impersonate|Delegate]" - Authentication level for COM security
responseDeadlockInterval="[Infinite | HH:MM:SS]" - For deadlock detection, timeout for responses when there are executing requests.
maxWorkerThreads="[number]" - Maximum number of worker threads per CPU in the thread pool
maxIoThreads="[number]" - Maximum number of IO threads per CPU in the thread pool
serverErrorMessageFile="[filename]" - Customization for "Server Unavailable" message
When ASP.NET is running under IIS 6 in native mode, the IIS 6 process model is
used and settings in this section are ignored. Please use the IIS administrative
UI to configure things like process identity and cycling for the IIS
worker process for the desired application
-->
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="machine"
password="AutoGenerate"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="20"
maxIoThreads="20"
/>
Trusted_Connection=false;
这将不采用信任连接方式(也即不采用Windows验证方式),而改由SQL Server验证方式,即在连接字中指定:User ID=user name;Password=user password;SQL Server会将此用户ID和口令进行验证连接,而与Windows帐号无关。
上述两种验证方式的设置(连接验证采用Windows和SQL Server验证,还是仅采用Windows验证),可以启动SQL Server企业管理器,然后在安全性配置中设置。
SQL SERVER 安全
IIS 目录安全
2)第二种方法,只需要将aspnet用户加入到administrator role 中即可,(sql中有administrator accout)不过可能要重启电脑,
备注下:以上二种方法都要将SQL设为window and sa 验证。