views:

24

answers:

1

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 System.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.

A: 

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)

Noel
I'm using SQL authentication for this project. I have also tried creating an app pool with all credentials for the local machine, but to no avail.
Charlie Brown