I've read a lot of articles. But as far as I know I've done all. On local computer VS2010 all works fine. The problem occurs only when working on IIS7 Server.
I want to start a exe file which works great on server if I start it manually from Windows Explorer.
Dim fiExe As New IO.FileInfo(IO.Path.Combine(diBase.FullName, "ClientBin\ConvertAudio.exe"))
Dim SI As New ProcessStartInfo(fiExe.FullName, args)
SI.Verb = "runas"
SI.UseShellExecute = True
SI.WorkingDirectory = fiExe.Directory.FullName
Dim P As Process = Process.Start(SI)
P.PriorityClass = ProcessPriorityClass.Idle
I've converted the directory ClientBin
in an Application in IIS.
But when using the service I receive this error (callback in Silverlight application):
{System.Security.SecurityException ---> System.Security.SecurityException: Sicherheitsfehler
bei System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
bei System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
bei System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
bei System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
bei System.Net.WebClient.WebClientWriteStream.<Dispose>b__3(IAsyncResult ar)}
I've tried to store the file "clientaccesspolicy.xml"
in same directory like ClientBin
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Still the same message. Any idea?
*** new info - verb *** When using this function
Dim startInfo As New ProcessStartInfo(fiExe.FullName)
Dim V As String = ""
For Each verb As String In startInfo.Verbs
V &= V & ", "
Next
Throw New Exception("Verbs=" & V)
I receive this result:
Verbs=, , , , , , ,
*** Solution found ***
I've found the solution while using http://www.fiddler2.com and http://technet.microsoft.com/en-us/sysinternals/bb896653
Problem was while using x86 application on a x64 IIS in combination with verb=runas
flag. Now application is set to anycpu (Perhaps that does not matter) and verb
on ProcessStartInfo is not set to anything.
Giving Full Control permission to any web users is always a very bad idea. For a better solution, please see Process.Start doesn't work in IIS
Edit:
After a long journey, me and Nasenbaer have found the following. The possible reasons for IIS to fail run an EXE are:
Original answer:
You need to assign FullControl security permissions for the IIS AppPool\DefaultAppPool
user, on the directory the EXE is located in. This is the user that is trying to run the process (assuming you are using the DefaultAppPool
), and without the proper permissions, it is unable to do so.
When you run the EXE manually, you are using the Windows logged in user. This is why you are able to lunch it manualy. The IIS uses the Application Pool user.
To add permissions just do the following:
IIS AppPool\DefaultAppPool
FullControl
Screenshot:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With