Showing Silverlight App in Browser From batch file on Win2008

限于喜欢 提交于 2019-12-24 21:43:36

问题


I am trying to open a web page with a Silverlight App from a batch file on a Windows Server 2008 box.

If I put this in the batch file:

start iexplore http://www.google.com

The google page shows.

If I put this in the batch file (where TestPage has a Silverlight Application):

start iexplore http://www.mysite.com/Configure/TestPage.html

the page shows but with the "Download Silverlight" icon/link.

If I browse to that page manually the app shows.

Any ideas on how to get around this?

I am trying to run my Silverlight tests (actually using PowerShell but the symptoms are the same and a batch file is easier to explain) on a our build machine which is a Windows Server 2008 box.

Edit: It looks like this is because the batch script is running the 64bit version of IE. When I launch the link as a user I get the 32bit version.

In my PoweShell script I am using this to get to IE:

$ie = new-object -com "InternetExplorer.Application" 

-but it too is getting the 64 bit version.

So really, my question has become how do I get to the 32 bit version of IE via COM?


回答1:


I stumbled upon an easy way around this. I changed my calling script from

        <Exec IgnoreExitCode="True" Command="powershell 
.\RunSilverlightTests.ps1 '$(DeploymentAddress)\TestPage.html'" >

To

        <Exec IgnoreExitCode="True" Command="%windir%\SysWoW64\cmd.exe /C 
powershell "& '.\RunSilverlightTests.ps1' 
'$(DeploymentAddress)/TestPage.html'"" >

This runs the script in the WOW (Windows on Windows = 32bit) version of the command line: therefore PowerShell is automatically served 32bit version of dlls.

You can run the simple batch file aboce from %windir%\SysWoW64\cmd.exe and it works too.

Took 3 days, but I got there :)

Cheers

Mark



来源:https://stackoverflow.com/questions/1264683/showing-silverlight-app-in-browser-from-batch-file-on-win2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!