SharePoint 2019 – Unable to Open Visio Files in Browser

Ran into a new issue with Visio Service Application and SharePoint 2016/2019. The failure is with trying to open Visio files in the browser.

The Document can’t be opened because it is not a supported Visio diagram.

Make Sure that the “Web Drawing URL” web part setting is set to a valid VSDX, VSDM, or VDW file.

We know that it’s a valid file since we can open it with Viso outside of the browser.

In the ULS logs we can see we fail with a permission issue trying to open the Content Database. This will happen if you’re running your Visio service application pool with a different account than the web application’s application pool.

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC SharePoint Foundation Database 880i High System.Data.SqlClient.SqlException (0x80131904): Cannot open database “WSS_Content” requested by the login. The login failed. Login failed for user ‘Contoso\WebServiceAccount’. at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at Microsoft.SharePoint.Utilities.SqlSession.OpenConnection() ClientConnectionId:4fc5e745-930d-48c7-bd5f-29416551fc91 Error Number:4060,State:1,Class:11 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC SharePoint Foundation Database 880k High at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command, Boolean retryForDeadLock) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand command) at Microsoft.SharePoint.Upgrade.SPDatabaseSequence.GetVersion(SPDatabase database, Guid id, Version defaultVersion, SqlSession session, SPDatabaseSequence sequence) at Microsoft.SharePoint.Administration.SPDatabase.get_BuildVersion() at Microsoft.SharePoint.Administration.SPContentDatabase.get_StoredProceduresSchemaVersion() at Microsoft.SharePoint.Administration.SPContentDatabase.get_SupportsGetSecureUrlForDocId() at Microsoft.SharePoint.SPFile.EnsureWebRelativeUrl() at Microsoft.SharePoint.SPFile.PropertiesCore(Boolean throwException) at Microsoft.SharePoint.SPFile.get_Exists() at Microsoft.Office.Visio.Server.GraphicsServer.SharePointFile.GetFile(Uri requestedFileUrl, Object userToken, String fileGuid) at Microsoft.Office.Visio.Server.GraphicsServer.DocumentManager.GetRasterPage(RasterPageRequest request, GetRasterDiagramCallback callback, ReaderWriterFlags& rwflags) at Microsoft.Office.Visio.Server.GraphicsServer.ServiceCore.GetRasterPage(RasterPageRequest request) at Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsService.GetRasterPage(RasterPageRequest request) at SyncInvokeGetRasterPage(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result) at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result) at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously) at System.ServiceModel.Channels.SecurityChannelListener`1.ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result) at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously) at System.Runtime.InputQueue`1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue`1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread) at System.Runtime.InputQueue`1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread) at System.ServiceModel.Channels.SingletonChannelAcceptor`3.Enqueue(QueueItemType item, Action dequeuedCallback, Boolean canDispatchOnThisThread) at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult result) at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult result) at System.Runtime.AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result) at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously) at System.ServiceModel.Channels.HttpInput.ParseMessageAsyncResult.OnRead(IAsyncResult result) at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at System.Web.Hosting.AsyncResultBase.Complete(Int32 hresult, Boolean synchronous) at System.Web.Hosting.PipelineRuntime.AsyncCompletionHandler(IntPtr rootedObjectsPointer, Int32 bytesCompleted, Int32 hresult, IntPtr pAsyncCompletionContext) 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC SharePoint Foundation Database 880j High SqlError: ‘Cannot open database “WSS_Content” requested by the login. The login failed.’ Source: ‘.Net SqlClient Data Provider’ Number: 4060 State: 1 Class: 11 Procedure: ” LineNumber: 65536 Server: ‘sql.contoso.com’ 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC SharePoint Foundation Database 880j High SqlError: ‘Login failed for user ‘Contoso\WebServiceAccount’.’ Source: ‘.Net SqlClient Data Provider’ Number: 18456 State: 1 Class: 14 Procedure: ” LineNumber: 65536 Server: ‘sql.contoso.com’ 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC SharePoint Foundation Database 3760 Critical SQL Database ‘WSS_Content’ on SQL Server instance ‘sql.contoso.com’ not found. Additional error information from SQL Server is included below. Cannot open database “WSS_Content” requested by the login. The login failed. Login failed for user ‘Contoso\WebServiceAccount’. 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC Visio Graphics Service Graphics Service 8061 Critical File not found at this location: https://sp/Docs/Test.vsdx Exception : Cannot retrieve the file 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.47 w3wp.exe (0x3254) 0x35DC Visio Graphics Service Graphics Service 8079 Critical Failed to generate raster diagram for file https://sp/Docs/Test.vsdx page -1 Error : System.ServiceModel.FaultException`1[Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsServiceFault]: The creator of this fault did not specify a Reason. (Fault Detail is equal to Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsServiceFault). 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.48 w3wp.exe (0x2650) 0x3748 Visio Graphics Service Web Access aputu High GetRasterPage Failed: Exception=System.ServiceModel.FaultException`1[Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsServiceFault]: The creator of this fault did not specify a Reason. (Fault Detail is equal to Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsServiceFault). 4477b79f-24a2-70c6-0173-a2d4bb51b53f

03/24/2021 13:28:14.48 w3wp.exe (0x2650) 0x3748 Visio Graphics Service Web Access 8078 Critical Failed to get raster diagram for visio file https://sp/Docs/Test.vsdx page default page ID Exception : System.ServiceModel.FaultException`1[Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsServiceFault]: The creator of this fault did not specify a Reason. (Fault Detail is equal to Microsoft.Office.Visio.Server.GraphicsServer.VisioGraphicsServiceFault). 4477b79f-24a2-70c6-0173-a2d4bb51b53f

To fix this script will add in that account to all the content databases

Add-PSSnapin *sh*


$vsa = Get-SPServiceApplication | ? {$_.TypeName -eq "Visio Graphics Service Application"}
$svcAccountName = $vsa.ApplicationPool.ProcessAccount.Name

Write-Host "Found the account $svcAccountName running application pool for Visio"
$yn = Read-host -Prompt "Would you like to apply AdminShell for account $svcAccountName to all content databases? Y/N"
If($yn -eq "y")
{

}
Else
{
    break
}

$cdbs = Get-SPContentDatabase -NoStatusFilter

Foreach($cdb in $cdbs)
{

    Try
    {
        Write-Host "Applying permissions for database $($cdb.Name)"
        Add-SPShellAdmin -UserName $SvcAccountName -database $cdb
        Write-Host "Sucessfully applied permissions for database $($cdb.Name)" -ForegroundColor Green
    }
    Catch
    {
        Write-Host "Failed to apply for database $($cdb.Name)" -ForegroundColor DarkRed
        Write-Host $_

    }

}

Leave a Reply

Your email address will not be published. Required fields are marked *