So people ask me this all the time, so I thought I’d blog about it…
Actually normally they say something like “I tried to launch Office on behind an ASP page and it [ errors | performance sucks | fails to save | etc ]”.
Here’s the answer.
The primary scenario for using VSTO on the server is to use the ServerDocument class to modify document content. Microsoft don’t recommend actually starting Office applications on the server behind ASP.NET pages, this as significant security and performance implications.
An overview of server side data access can be found here: http://msdn2.microsoft.com/en-us/library/h7eb01hx.aspx
Just to be clear you can get this to work – many people have. You need to allow the ASP process to instantiate COM components (e.g. Word) and this means changing it’s security permissions. The biggest issue is now your ASP.NET process is creating instances of (say) WINWORD.EXE which is going to eat a very unhealthy 10Mb or more of memory just sitting there, not to mention the overhead for creating the process in the first place and communicating with it cross process and over interop using COM.
In the VBA timeframe people used to run Office behind ASP pages and tell me they could support 10-20 users per server! Obviously things have improved since then; servers are bigger and more powerful and ASP.NET is more efficient than ASP. That doesn’t change the underlying problem, you’ll just get slightly more users per box.
I should also mention that there are some samples on how to use VSTO with server side applications on MSDN: