Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET PHP
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
 
$Obj = new COM ('MyNamespace.MyClass');
$Obj->MyMethod();
 
?>
 
Please help.
Posted 9-Nov-12 3:03am
Edited 9-Nov-12 3:29am
v4

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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/[^]
  Permalink  
v3
Comments
Tech Code Freak at 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 at 9-Nov-12 8:38am
   
See updated answer.
Tech Code Freak at 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 at 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 at 10-Nov-12 10:30am
   
Accepted + 5up
Tech Code Freak at 10-Nov-12 10:41am
   
Your answer helped a lot!
Perfect one for Asp.net through PHP.
 
But as the hosts don't give access to gac to add assembly file, PHP was hard to get going.
 
PowerShell too was out of reach.
 
So, I used vbscript for the same and guess what?
It's working!
 
The resolution to the problem is no doubt different from your answer but still, it was very helpful in the research.
 
Thanks again!

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 195
3 DamithSL 195
4 Richard MacCutchan 178
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100