These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

How to setup FileVista for use with SSL certificate

Hi there, 
I seem to be having trouble setting up FileVista for use with SSL on IIS7.  I've got filevista connecting
to a SQL Server 2008 R2 database but can't seem to get the SSL certificate (which is installed and registered 
and installed on the site and bound to the FileVista web app.  I have a different port being used (other than 443)
for filevista.  I am using a url similar to the following in trying to connect to filevista https://domain.com:99

I get the two different errors depending on which app pool I am using.  I get the following error when 
setting the filevista app to use the Classic ASP.NET app pool:

Server Error in '/' Application.
Cannot open database "FileVista" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\Classic .NET AppPool'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "FileVista" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\Classic .NET AppPool'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Cannot open database "FileVista" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\Classic .NET AppPool'.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6244425
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2811
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +248
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6260362
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6260328
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6261592
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6265031
   System.Data.SqlClient.SqlConnection.Open() +258
   GleamTech.FileVista.DataManager.GetConfiguration() +122
   GleamTech.FileVista.ApplicationManager.LoadConfiguration() +52
   GleamTech.FileVista.ApplicationManager..cctor() +1073

[TypeInitializationException: The type initializer for 'GleamTech.FileVista.ApplicationManager' threw an exception.]
   GleamTech.FileVista.GlobalAsax.Application_AcquireRequestState(Object sender, EventArgs e) +484
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927 




I get the following error when using the FileVista app pool created when I set up filevista as a web
app in IIS:

Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
   System.Reflection.Assembly.GetType(String name, Boolean throwOnError) +40
   System.Web.Compilation.BuildResultCompiledType.GetPreservedAttributes(PreservationFileReader pfr) +75
   System.Web.Compilation.PreservationFileReader.ReadFileInternal(VirtualPath virtualPath, String preservationFile, Int64 hashCode) +539
   System.Web.Compilation.PreservationFileReader.ReadBuildResultFromFile(VirtualPath virtualPath, String preservationFile, Int64 hashCode) +11196428
   System.Web.Compilation.DiskBuildResultCache.GetBuildResult(String cacheKey, VirtualPath virtualPath, Int64 hashCode) +92
   System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode) +193
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +97
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +50
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +676


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927 
Bob 1/13/2011 5:11 PM
Does anyone have any ideas?  I am at a loss.  I've also tried forcing the app into 
32-bit mode at the application level to no avail.

Thanks in advance for any suggestions. 
Bob 1/17/2011 5:41 AM
Hi Bob,

does your setup work without SSL? Not beeing able to connect to the database doesn't sound like a SSL problem to me.

Cheers,
Chris
Chris 1/19/2011 1:30 AM
Oh I just noticed something else:

Are you using filevista v4.1? If yes: it needs asp.net v4! You seem to be using asp.net v2... Maybe this has something to do with it?

Chris
Chris 1/19/2011 1:32 AM
Firstly these errors are nothing to do with SSL.

I guess you are using a SQL Server database. When you change the app pool, the associated account is changed so you should make sure that account has access to the SQL Server database.

So in the first case, when you change to the Classic ASP.NET app pool, the error message says:

>Cannot open database "FileVista" requested by the login. The login failed.
>Login failed for user 'IIS APPPOOL\Classic .NET AppPool'.

Which means you simply need to give access to "IIS APPPOOL\Classic .NET AppPool" account (eg. db_owner role) for the database in SQL Server Manager.

In the second case, you change to the default app pool which is Integrated Mode. It seems you already gave access to this app pool's account on the database so you don't get a database connection error, instead you get:

>Security Exception
>Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Which is a different error and related to the insufficient trust level. Starting with v4.0, FileVista supports Medium-Trust level. In earlier versions, it only supported Full-Trust level. So it seems your machine configuration does not even support Medium-Trust level (maybe it's set to use low-level by default). You can try to override the local setting in FileVista's web.config by adding this setting after <system.web> tag:

<trust level="Medium" />

However your machine configuration may not allow overriding in local web.config files and you may still get an error. Then you need to edit

<WindowsDir>\Microsoft.NET\framework\v2.0.50727\config\web.config 

and add these settings under the <configuration> level:

  <location allowOverride="false" path="Default Web Site/FileVista">
    <system.web>
      <trust level="Medium" originUrl=""/>
    </system.web>
  </location>

This will apply Medium-trust to just the site/application set in the path attribute, e.g "Default Web Site/FileVista" or some other web site/application name as defined in IIS. Please refer to trust Element (ASP.NET Settings Schema) for more details.

Note that I assume you are using FileVista 4.0 as it runs on ASP.NET 2.0. Looking at your error messages, you are running ASP.NET 2.0:

>Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927 

FileVista 4.1 requires ASP.NET 4.0 and if ASP.NET version was the case you should have got a different error such as:

>Parser Error Message: Could not load type 'GleamTech.FileVista.FileVistaHttpApplication'.
Cem Alacayir 1/31/2011 3:45 PM