Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone!

I want to call a .Net method through a scheduler.
This scheduler provided by the web host can run php scripts.

So now, I need to call the .Net method MyMethod() of Class MyClass belonging to namespace MyNamespace everyday at 00:00 hrs.

This can be possible if it is called from a php script scheduled to be run by the scheduler.

I have added a php script as follows to call the method. But cant see any result.
Please check if correct. And point out the mistakes.

PHP
<?php

$Obj = new COM ('MyNamespace.MyClass');
$Obj->MyMethod();

?>


Please help.
Posted
Updated 9-Nov-12 2:29am
v4

1 solution

I'm not exactly sure what the issue is, but you can check what you've done against the following guide:

http://www.peachpit.com/articles/article.aspx?p=27291[^]

Failing that, you might also want to take a look at:

http://www.php-compiler.net/doku.php[^]

You create the key file on your development machine and sign the project with it. You'd have to ask your web host if you can deploy something to the GAC - they might be iffy with this, but maybe there is another solution - if you need to call a .net method from a scheduler, could you not do this with powershell?

http://www.leeholmes.com/blog/2006/10/27/load-a-custom-dll-from-powershell/[^]
 
Share this answer
 
v3
Comments
Tech Code Freak 9-Nov-12 8:35am    
Saw the 1st link. Good one. It is what I wanted. But now, I dont know:
1. How to create a Key File on my web Host's server.
2. How to add the assembly file to my web host's GAC.
How do you do it??

Or is there any other way out?
jim lahey 9-Nov-12 8:38am    
See updated answer.
Tech Code Freak 9-Nov-12 8:42am    
Sorry, Not familiar with Powershell.
Would try to learn something about Powershell now.
Can we call ASP.Net methods directly from powershell without GAC entry?
jim lahey 9-Nov-12 8:55am    
Yes you can. You can load the assembly straight from disk. I've updated the answer with a link.
Tech Code Freak 10-Nov-12 10:30am    
Accepted + 5up

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