Web service

N

nirmal

I am trying to call a assembly from a web service i get
the following error when i try to execute the web service
"System.IO.FileNotFoundException: File or assembly name "
Can yu provide any solution to get thru this error

With Regards
nirmal
 
N

nirmal

Please find the enclosed code

Webservice part code
------------------------------
[WebMethod]
public bool CanWeFixIt()
{
AppDomain secondDomain =
AppDomain.CreateDomain ("New AppDomain");
secondDomain.ExecuteAssembly
("CallTestAssembly.exe");
return true;
}

CallTestAssembly Code
--------------------------------
namespace CallTestAssembly
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the
application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Console.WriteLine ("in
CallTestAssembly");
//
// TODO: Add code to start
application here
//
}
}
}

WebService Client code
-----------------------------
private void triggerButton_Click(object sender,
System.EventArgs e)
{
//string DataSource;
string strTemp;
bool bTemp=false;
Service1 myService = new Service1
();
bTemp = myService.CanWeFixIt();
if(bTemp)
{ strTemp += "Assembly called";
resultLabel.Text = strTemp;
}
}

With Regards
Nirmal
 
J

Jan Tielens

Try adding the location of the exe:
secondDomain.ExecuteAssembly
(@"C:\myDir\CallTestAssembly.exe");

Btw, you could also use Process.Execute to fire of exe's.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


nirmal said:
Please find the enclosed code

Webservice part code
------------------------------
[WebMethod]
public bool CanWeFixIt()
{
AppDomain secondDomain =
AppDomain.CreateDomain ("New AppDomain");
secondDomain.ExecuteAssembly
("CallTestAssembly.exe");
return true;
}

CallTestAssembly Code
--------------------------------
namespace CallTestAssembly
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the
application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Console.WriteLine ("in
CallTestAssembly");
//
// TODO: Add code to start
application here
//
}
}
}

WebService Client code
-----------------------------
private void triggerButton_Click(object sender,
System.EventArgs e)
{
//string DataSource;
string strTemp;
bool bTemp=false;
Service1 myService = new Service1
();
bTemp = myService.CanWeFixIt();
if(bTemp)
{ strTemp += "Assembly called";
resultLabel.Text = strTemp;
}
}

With Regards
Nirmal

-----Original Message-----
Maybe we can help you if you post some code?

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan





.
 
D

Dolly

Try putting the exe file in the bin folder in the
webservice directory.

Does that solve your problem?

Dolly
 
G

Guest

I tried but it did not work . I think it shd be put in the
folder from where by default any webservice fetches the
required dll or exe may be in WINNT folder

Yur comments are invited
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top