开发者

nHibernate on IIS 7, SQLClientPermissionException

I am developing an MVC application using nHibernate; running through VS's built in web server the application runs without errors. When setup and running through IIS7 on localhost, the application throws a SQlClientPermission exception after calling Sys开发者_运维问答tem.Data.SqlClient.PermissionDemand (SqlClient calls this internally)

I have enabled the application to run under full trust but it doesn't seem to affect the outcome.


From the description, I'm guessing that you're using Integrated Security in your connection string. Maybe something along the lines below.

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

When running through VS built in web server, it runs under your credentials and that's why it works.

To get this to work on IIS, either

  1. Create a new IIS app pool which runs under your credentials
  2. Or, use sql authentication.

(Let me know if you like me to expand further)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜