Application Roles with Enterprise Library RRS feed

  • Question

  • Has anyone successfully used an application role with the Enterprise Library?


    I'm connecting to SQL 2005, using Windows Authentication via the Enterprise Library. I initially call DatabaseFactory.CreateDatabase() to connect under the context of the current user.


    Once connected, I call sp_setapprole to switch the context of the connection. I can always call this sproc successfully.


    When I call additional sprocs using the GetStoredProcCommandWrapper/LoadDataSet methods, I get one of two errors:


    1)If connection pooling is off, I get the error : System.Data.SqlClient.SqlException: A severe error occurred on the current command.  The results, if any, should be discarded.

    2)If connection pooling is on (by default), I find that the security context just doesn't get switched


    Can anyone help with this?



    Tuesday, August 14, 2007 5:30 PM


  • I've figured this out.....


    If you add the following parameter to dataconfiguration.config then the application role works fine:


    <parameter name="connection reset" value="false" isSensitive="false" />

    Wednesday, August 15, 2007 5:10 PM