Freigeben über


Use server capabilities of VSTO ..(and you'll need to play a bit with IIS)

This was one really really interesting case that I handled a few days back. A real long case with a real cooperative customer (Somehow I am always lucky in that regard)

So .. here is the background. There is a great sample on MSDN which demonstrates server capabilities of VSTO. There is even one more page dedicated to explain the features of this sample. A great sample but somehow misses an important thing ..(or assumes an important thing -- depending on what's your perception :))

When you download this sample and and set the .NET permissions and hit debug, this thing works flawlessly on ASP.net Development server. But,I am sure that you don't really want to use it from there. You need to publish it on the IIS.

When you try to do it, the first thing to remember is download "Application Manifest Editor"  and modify the deployment manifest (yes the one that gets stored in the application -- heck, why did they call it deployment manifest !). Then publish the VSTO application on the forms folder under the web site. And a few more nitty gritties that I hope you'll be able to do.

Then you  publish it (surely with the hope that it will work). guess what ! -- It fails ! (not on all machines .. but atleast it did on my test box(es) and my customer's machine). You'll know why ..

Let me explain further -- Here is the basic workflow of the sample.

1) You log on to the web site using ASP .net 2.0 "Forms Authentication" (btw, this thing is really cool, I didn't know totally revamped it-- i'll blog about it afterwards)

2) Then your request for a form (which is basically a word document)

3) When you request for a form an httphandler (BenefitFormHandler.cs) executes (or ..should execute)

4) This http handler pulls up some data from the database modifies the manifest of the doc and the cached data (note..we are just using ServerDocument.AddCustomization so no risk of running into https://support.microsoft.com/kb/257757 ) and write the document to the client HTTP stream.

At this point, you must be thinking, where is the issue -- Yess -- you hintpickers! its at httphandler (well not exactly but that's what it initially seemed ).

Actually, for any httphandler to work you need to tell IIS that *this extension"(*.doc) will be  handled by IIS. So ..we have to associate doc to aspnet_isapi.dll. If we don’t do it then IIS will not give ASP any chance to handle the http request.

Here is the pic ..

image

 

 

del.icio.us tags: Pranav Wagh, Microsoft Blogger, VSTO, Sample, Troubleshooting

Technorati tags: Pranav Wagh, Microsoft Blogger, VSTO, Sample, Troubleshooting

Comments

  • Anonymous
    December 18, 2008
    I have created a office word solution where i get the data in the form from database and saved it back to the database. I want to add this project/ doc project with in the office so that they dont have to aithenticate again . Can you let me know how to do it . I am using forms authentication in the website. Thanks Chanchal I think this might requires some research/troubleshooting, can you get a case created with PSS so that I can loopin appropriate responses and for your your case