Process.start() in Asp.net core app : Failed to create an ipc port, Access denied :(

Nicoco 1 Reputation point
2022-04-25T14:39:01.05+00:00

Hello everybody,

I wrote a little web api using ASP.net core, running on IIS.

In this API i have to launch an EXE, wait for execution, then push an answer to the client who invoke my API.

After a few use of this API, my process.start() fail and i can find a log with

System.Runtime.Remoting.RemotingException: Failed to create an ipc port: Access denied.

If i reboot my IIS server or the API : No changes. If i reboot Windows Server, it's ok and will be ok for a few invokations.

My process is launched like that :

Process myprocess = Process.Start("xwpf.exe", paramLancement);
myprocess.WaitForInputIdle();
myprocess.WaitForExit();
myprocess.Close();
myprocess.Dispose();

Anyone have some idead why i got this error so quickly and why a reboot solve this issue ?

Thanks a lot

Internet Information Services
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,078 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,098 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,542 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 53,426 Reputation points
    2022-04-25T15:12:06.177+00:00

    The process you start probably exited (or crashed) without close the socket. A reboot fixes this. But you can install the sysinterals tools and use tcpview to close the port

    https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview


  2. MotoX80 31,391 Reputation points
    2022-04-26T16:02:00.763+00:00

    Use a "run as administrator" powershell prompt and look for "stuck' instances of your program.

    Get-Process -Name xwpf                            # display instances  
    

    If you find any, kill them.

    Get-Process -Name xwpf | Stop-Process -Force      # kill them  
    

    You will then need to figure out why they are hanging. What logging feature does this xwpf program have? Does your web API capture stdout and stderr from xwpf? What's in there?

    I have no experience with "Dot Net Core", but from my past experience with IIS, when I would launch a sub process it could potentially run as the IUSR, the worker process identity, or the end user account (if I had impersonate=true set). Do you know what account your process is running as, and does that have an effect on it's execution?

    You might want to trace the activity of that program and also the IIS worker process.

    https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

    0 comments No comments