conversion of word to html through Microsoft office Library

conversion of word to html through Microsoft.Office.Interop.Word.ApplicationClass is working fine when i am running my website through visual studio, but when i run the same in the same website through IIS 7 , Conversion of word to html is not working ?
    I am calling a WebMethod for conversion of word to html through javascript. I have tested by putting OnSucess and OnFailure Function in javascript to check is it working or not .

Through Visual Studio - OnSucess function is executed
Through IIS  - OnFailure function is executed

Web Method
<System.Web.Services.WebMethod()> _
        <System.Web.Script.Services.ScriptMethod()> _
        Public Shared Function Convert(ByVal inputHtml As String) As String

            Dim objWord As Microsoft.Office.Interop.Word.ApplicationClass
            Dim doc As String = inputHtml
            Dim splitHtml As String() = doc.Split(New Char() {"/"c})
            Dim splitvalue As String
            splitvalue = splitHtml(splitHtml.Length - 3) + "\" + splitHtml(splitHtml.Length - 2) + "\" + splitHtml(splitHtml.Length - 1)
            Dim Splitcheck As String() = splitHtml(splitHtml.Length - 1).Split(New Char() {"."c})
            Dim path2Convert = System.Web.HttpContext.Current.Server.MapPath(".\" + splitHtml(splitHtml.Length - 3) + "\" + splitHtml(splitHtml.Length - 2) + "\" + Splitcheck(Splitcheck.Length - 2) + ".html")

            If (System.IO.File.Exists(path2Convert)) Then


                    Dim strWordDoc = inputHtml
                    Dim strHTMLDoc = path2Convert
                    objWord = CreateObject("Word.Application")
                    objWord.Visible = False
                    Dim FileFormat
                    Dim LockComments
                    Dim Password
                    Dim AddToRecentFiles
                    Dim WritePassword
                    Dim ReadOnlyRecommended
                    Dim EmbedTrueTypeFonts
                    Dim SaveNativePictureFormat
                    Dim SaveFormsData
                    Dim SaveAsAOCELetter
                    FileFormat = 8
                    LockComments = True
                    Password = ""
                    AddToRecentFiles = False
                    WritePassword = ""
                    ReadOnlyRecommended = False
                    EmbedTrueTypeFonts = False
                    SaveNativePictureFormat = True
                    SaveFormsData = False
                    SaveAsAOCELetter = False
                    objWord.ActiveDocument.SaveAs(strHTMLDoc, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter)
                    objWord = Nothing

                Catch ex As Exception
                    'objWord = Nothing
                End Try
            End If

            Return inputHtml

        End Function

Javascript Code -

function AssignPath(strPath,strDocType,intDocId,strUploadId)
var PathSplit;
PathSplit = path.split('.');

if ((PathSplit[PathSplit.length - 1] == "doc") || (PathSplit[PathSplit.length - 1] == "docx")) {

     PageMethods.Convert(path, OnSucess, OnFailure);
     var output = path.substr(0, path.lastIndexOf('.'));
     path = output + ".html";

     function OnSucess(result) {

    function OnFailure() {

       alert("Conversion Failed");



Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vadim RappCommented:
Almost certainly it's security-related issue, where IIS has less permissions than you. While it's hard to tell blindly what exactly is going on, I would look into (1) details of the exception raised by OnFailure, if any are available; then look in the event log, if there's anything generated at the time when this happens; then you can invoke audit policy /audit object access in Local security policy, and look at the events that will be generated.
depaaAuthor Commented:
We have solved this with advice from other experts
depaaAuthor Commented:
We solved it in two different ways and i ma putting it here for the benefit of others.

Option 01. Since the application is a web based application and is trying to display a Microsoft word file in a web frame - we called Google doc to open the document for us in that frame. But, this solution will work as long as call to Google Doc  will work free or as long as they will not charge for this service.

Option 02. I am providing this with some reservations. Since I have got this solution from another Forum and I do not think that it is ethical to "Cut-copy-paste" solutions from one paid forum to another paid forum - I have the reservation.

Please check the following Link for the solution in the 2nd way - 

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
depaaAuthor Commented:
We waited for quite some time and did not get the help in time.

We solved it ourselves using one way and the other way was from advice from another forum.
Vadim RappCommented:
It's good that the author has solved the problem; however, I would like to note that the solution they found really isn't a solution of the problem that was in place here; it's in fact abandoning the original solution and implementing totally different one.

The mere fact that this code was already working in Visual Studio, means that it could be done; Visual Studio creates its own webserver, and the only difference between this webserver and IIS is in the credentials it runs under. With Word, it's quite obvious that if IIS is running under another credential than the user, there could be issues with Word not running on that credential "out of the box", same as it wouldn't run for another user, and might require an installation. Or even if it did run, this might be an issue as trivial as Word on the first launch showing modal dialog box requiring the user to enter the initials - maybe Word "showed" it to IIS. In any case, since the solution already worked on credential A and the matter was to port it to credential B, the most straightforward was to find out the difference between A and B and eliminate it. As a last resort, to try to run IIS with user's credential and allowing the service to interact with the desktop.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.