Thursday, September 11, 2014

Trusted connection string is not allowed on IIS?

Trusted connection string format doesn't work when in IIS..


cfg.DataBaseIntegration(c =>
    {
        c.Driver<NHibernate.Driver.SqlClientDriver>();
        c.Dialect<NHibernate.Dialect.MsSql2008Dialect>();
        c.ConnectionString = "Server=.;Database=RideOfYourLife;Trusted_Connection=True";

        c.LogSqlInConsole = true;
        c.LogFormattedSql = true;                    
    });


.., the error cascades to ServiceStack as:
response Status
error CodeExceptionmessageError trying to resolve Service 'Marshaller.TheServices.ReservationResourceService' or one of its autowired dependencies (see inner exception for details)



The error is not helpful at all, so I tried to wire a simple IoC-injected object, that is an object with no database connection, and voila, the error gone!


Tracked the error in connection string, must change it to standard format:

cfg.DataBaseIntegration(c =>
    {
        c.Driver<NHibernate.Driver.SqlClientDriver>();
        c.Dialect<NHibernate.Dialect.MsSql2008Dialect>();
        c.ConnectionString = "Server=.;Database=RideOfYourLife;User Id=sa; Password=opensesame;";

        c.LogSqlInConsole = true;
        c.LogFormattedSql = true;                    
    });


I have yet to find out how to make trusted connection string work on IIS


Happy Coding!

1 comment:

  1. I'm having an issue where the connection string won't work if I try Trusted_Connection.

    ReplyDelete