SharePoint24x7 It's all about SharePoint.


Fix it – Office Web Apps couldn’t open the document for viewing because of an unexpected error

Posted by Joy

I tried Office Web Apps with SharePoint 2010 when the product was in beta and I was thrilled with the features introduced. I also setup a virtual machine with SharePoint 2010 and Office Web Apps on the very next day after they released the RTM bits of SharePoint 2010 and Office Web Apps. I did few articles on the same topic using that virtual machine and recently I updated it with Service Pack 1 bits.

I applied SharePoint Foundation 2010 SP 1, SharePoint Server 2010 SP 1 and Office Web Apps SP 1 and I tried opening a Word document using browser and then boomed. I got the following error when I try to open a Word document within browser. The error says "Word Web App cannot open this document for viewing because of an unexpected error. To view this document, open it in Microsoft Word".

Office Web App error

Office Web App error

Usual troubleshooting exercise started by going to ULS logs. ULS logs stated that Word Viewing Service cannot access the database server and also it stated that App Pool account doesn't have write permission to C:\Windows\Temp directory. Next, I checked the Windows Event Viewer and it also stated that the database server is not accessible and the related content database is not accessible by the App Pool account.

I went and checked the SQL Server security and found out that App Pool account already has been given right set of permission and then checked the file permission to C:\Windows\Temp directory. What I found out was that write permission was assigned to a group called WSS_ADMIN_WPG and when I checked closely I saw that my App Pool account was part of the same security group. Then where was the issue?

I started Googling and found out that some of the users encountered this when you have Active Directory also running in the same machine. Then I found out some PowerShell scripts from to configure Word Viewing Service and PowerPoint Service Applications to disable Sandboxed execution which is preventing Office Web Apps to function properly in a machine in which we have both Office Web Apps and Active Directory configured.

I ran those commands there was no luck and then I was breaking my head for few minutes to find out why is this happening? Then I remembered that I have another service account which I have configured to run all the Service Applications in my farm and I went and checked SQL Server security again for the content database for the same account. Damn, that account didn't have access to the content database. I added the same service account which I have configured to run all my Service Applications as a new login to the content database and assigned the "db_owner" role.

Wow, Office Web Apps started working nicely as I expected.

I thought of sharing this experience so that when you get the above error, now you now what are the things you need to check to fix the problem.