How to run executable from WCF service with IIS support?

We have a WCF service, which we recently switched from self-hosting to IIS hosting. To run the executable file, you must run Process.Start (). This works fine when it runs on its own, but when placed in IIS we get an error:

System.ComponentModel.Win32Exception: the system cannot find the specified file

We have exe both in the bin directory and in the root of the application (next to the .svc file.) But it does not seem to be able to find exe.

Any help would be greatly appreciated. Thanks!

EDIT: I forgot to mention that we are running the following code: Process.Start ("LeakingWrapper.exe");

FURTHER INFORMATION: Unfortunately, we do not have the ability to switch exe to a DLL, because it is a shell of a third-party library that has memory leaks. Therefore, we must include it in our own process to ensure that our long-term WCF service does not leak!

+5
source share
3 answers

Is the parameter set aspNetCompatibilityEnabledto true? In this case, you will HttpContexthave one that you might try to use to call something like:

string exeFileName = HttpContext.Current.Server.MapPath("~/LeakingWrapper.exe")

Or: what if you specify the entire path to the EXE, for example.

Process.Start("C:\yourServiceDir\bin\LeakingWrapper.exe") 

Does it help at all?

Mark

+3
source
Answer to

marc_s is probably correct.

However, it may also be that the process cannont find the file because it does not have permission to read the exe file.

0

- HttpContext, - web.config

<configuration>
<system.serviceModel> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
</system.serviceModel> 
</configuration>`
0

All Articles