cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tony_malandain
Level 3

Agent not working from a .Net Web Application

Hi all.
We have built a .net web application to let the administrator manage our product. We have one page that is responsible for displaying available updates and installing them if the administrator decides to.
My code works fine when run from a .Net console application (it returns 1 update as it should) but returns no updates when executed from the w3wp process (asp.net process under Win2003) under the same account. I debugged the code, and it goes happily through the lines of code, but it doesn't detect any update, nor does it throw any exception.

Any idea what's wrong? How can I troubleshoot this? I've check the event viewer but there are no entries.
I've tested with both version 3.1 (our official) and the latest 4.5 found on the update service site but to no avail.
I've added http://updates.installshield.com to the secured site list, but it didn't make any difference.

Thanks.
/T.
0 Kudos
(12) Replies
KellyF
Level 9

Hello Tony,

Could you confirm whether IIS is running under the system account or under a windows user account? If you're using the system account, please try creating a new user with privileges to the web app folder and use it to log in as the service. For the sake of testing, just create the user as an admin so that you won't have problems with permissions, you can then scale back from there.

Oh and please post to back so others will know whether this helps...

Regards,
KellyF
0 Kudos
plipli
Level 3

The following are come from the Update Service Help in the Update SDK. Can someone confirm these?

Updating Web Applications
The Update Service Agent can be called from a Java Server Page, by Dynamically Embeding the Update Service on the Web server. This allows a server administrator to check for updates from a Web page.

Prerequisites
The Web-application must be registered with the Update Service Publisher, as a product.
The Web-server application must support Java Server Pages. IIS is not currently supported.
The application server must have the following components installed:
The Update Service Agent
Deus.war, a Web Archive file that includes Deus.jsp and the required tag libraries. (Available as a separate download.)
A custom JSP page that includes a check for updates, either as a CGI request or in JSP tags.
0 Kudos
KellyF
Level 9

I'm not quite sure as to what you mean by "can anyone confirm"?
Is there such a thing? Yes, there is.

Regards,
Kelly
0 Kudos
plipli
Level 3

I mean ASP.NET applications are built on IIS. Is the sentence "IIS is not currently supported." true? Or I misunderstand something?

Thank you
0 Kudos
KellyF
Level 9

Your question was about the dynamic embedded component, which is java-based and therefore will not run under IIS. (granted, you could add an ISAPI plugin to route requests for that component to tomcat behind IIS, but that's slightly different)

You can embed the Windows agent into your ASP.NET pages using COM interop to accomplish much the same thing, but the component you referenced is definitely not able to run under IIS.

Regards,
Kelly
0 Kudos
plipli
Level 3

Hi Kelly,

In the above post, you said:
"If you're using the system account, please try creating a new user with privileges to the web app folder and use it to log in as the service."

Could you give me more detail on sentence - "use it to log in as the service".

Right now, if I try to check our updates from a console application, it works OK. But if I put the same code in our Windows Service function (Init() for testing) or Web page form load function, the EnumUpdates() function always return zero item in the Updates collection. There is no exception. Could you give me some clues?

Thank you very much!
0 Kudos
KellyF
Level 9

I was referring to the publisher Windows Service... "Update Service 4.60" in the Windows Services control panel... to run that service as a standard user, and not as the local system account... however, it sounds like you're trying something different.

I must say that calling out to the agent as a Windows service isn't something that we've necessarily tested with, so your mileage may vary... However, based on your description, your callout works fine from a "regular" app. Is your Windows Service running as a named user, or as "local system"? If it's running as Local System, there may be problems in the way Windows doles out permissions.

To test this: create an administrative user on that machine, set your windows service to run as that user, then have your service try calling out to the Update Service.

Regards,
Kelly
0 Kudos
plipli
Level 3

Our Windows Service account is created under the domain controller and it belongs to admin group.
0 Kudos
KellyF
Level 9

To be honest, I'm not well-versed in Windows Services other than that they have some limitations in what they can do. You could try submitting this to support, but to be honest, as it does work outside of windows services, I'm not sure they'd be able to do much there.

A couple things you could do would be:
1. Try running it under a local account rather than domain account.
2. Try dumping out the system variables at the point you would call the agent. That would give an indication of what it's able to access and what it knows about.

Kelly
plipli wrote:
Our Windows Service account is created under the domain controller and it belongs to admin group.
0 Kudos
plipli
Level 3

From my Windows Service, the notepad.exe can be opened, but the agent.exe cannot.
0 Kudos
KellyF
Level 9

Again, the agent needs information about where to locate items in the environment. For example, if you launch notepad from your service, can it open up files from your user directory or all user directory without you hardcoding the path... (ie shell("notepad myTextFile.txt") where that file is in the users documents & Settings)

If not, then it's much the same. I believe there are certain variables set for user interactivity that are simply not set for services. For your testing purposes, you can try calling notepad with %APPDATA%\myfile.txt or %ALLUSERSPROFILE%\myfile.txt variables. Place the file in that referenced folder and see if notepad opens it or not.

If that were to fail, then just do something like shell("set > c:\blah.txt") to get yourself a list of available variables and their settings & compare to when you're running as a user.

Kelly
0 Kudos
plipli
Level 3

Hi Kelly,

Thank you very much for all your replies!

Opening a notepad.exe and agent.exe in a Windows Service application is just one of my tests. I will not spend more time to dig it.

Our real purpose is:
We want to do a truly automatic update. This means our customers even don't need to do a single click. We want to create a Windows Service application that will periodically check updates. If find some, download and install them one by one silently.

Inside the Windows Service application, I tried to use code in the following to get our updates
DWUpdateServiceLib.Agent agent = new DWUpdateServiceLib.Agent();
DWUpdateServiceLib.Updates updateCollection = agent.EnumUpdates(strProductCode);

But the updateCollection is returned with zero item. (If I put the same code to my console application, and use the same log on account, it will return the correct count of updates).

Could your company confirm it is a limitation for the DWUpdateServiceLib COM component to do any server side automation? If yes, I will give up the scenario. I already spend too much time on this. If no, I would also like to know if a silent download and install will work inside a Windows Service application (It works for a console application). Thank you!
0 Kudos