Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created one windows service in VB.Net in which i am updating MS Project data and it works fine.
But after I install it in services.msc using installutil -i "exe path", it do executes but it is unable to open MS project application.

Error is sometime RPC call and sometimes the argument is invalid.
VB
Process.Start("Winproj.exe")
If MS_ProjApp Is Nothing Then        
            MS_ProjApp = New Microsoft.Office.Interop.MSProject.Application
            MS_ProjApp.DisplayAlerts = False
            MS_ProjApp.DisplayScheduleMessages = False
            MS_ProjApp.DisplayWizardErrors = False
            MS_ProjApp.Visible = False

            Dim sTemplate As String = String.Empty

            sTemplate = "<>\ProjectName"    
            Dim blnStat As Boolean = False

            Try
                blnStat = MS_ProjApp.FileOpenEx(Name:=sTemplate, ReadOnly:=False, FormatID:="MSProject.PSI.12")
                MS_ProjApp.ActiveProject.ProjectSummaryTask.SetField(MS_ProjApp.FieldNameToFieldConstant("HCL ProjectID"), "323241")

                blnStat = MS_ProjApp.FileSave()

blnStat = MS_ProjApp.Publish(WssUrl:="http://hsblswssen5003/pwa/Project_7")

                MS_ProjApp.FileCloseEx(Save:=Microsoft.Office.Interop.MSProject.PjSaveType.pjSave, CheckIn:=True)

            Catch ex As System.Exception
                'SendMail(ErrorMessage, 5, " Project Name: " + prj.ProjecĂName + "<BR> Project Id :" + prj.ProjectCode)
            End Try

Note: may be there is some security account problem as we run this code in development environment without installing, then it works fine.

Please help me out.
Any help would be appreciated!
Posted
Updated 14-Jun-10 23:26pm
v2

ankurgupta246 wrote:
Note: may be there is some security account problem as we run this code in development environment without installing, then it works fine.


Under which account type the service is running? Local Service, Network Service, Local System or User.
Try running it under Local System and check if the problem still persists?
 
Share this answer
 
I tried each account but it do not works ... so i suggest if you have project server 2007 then just paste my code in win service and let you try once.

Actually the two things cant communicate after installing win service.
 
Share this answer
 
Comments
Ankur\m/ 15-Jun-10 7:22am    
Firstly, you should use comment to reply to a member's answer. I am not notified if you add an answer to your question, so chances are low that I would read your answer. Moreover it is not an answer. So all discussions should go in comment as I am doing now.

No, I do not have Project Server 2007. I have worked with Win Services and have seen different kinds of error but of course not all of them. You have not given the error message as well.
But, I could suggest you something. You have the exact error message. Try searching Google with the error message. I am sure you will get a lot of hits.
ankurgupta246 15-Jun-10 7:30am    
Actually ankur i also worked lot in windows service but while i am opening winproj.exe and then try open any project then it gives error "the argument is not valid" so i have stucked on the same .. there is only one message comes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900