0

I have a little utility application that runs some Subversion commands for different scenarios (basically just to make a couple standard activities I do a bit easier).

In that application I use System.Diagnostics.Process to run a set of svn commands (the one in question is an update command). When running this though I get back an svn E175013 unable to connect to a rpository at URL '[url]' and Access to '[repository]' forbidden. (I'm getting that in the process.StandardError message back) Seems straight forward enough, but when I run the same command from a command line it succeeds without error and runs the update.

The command being run is:

svn update "[directory]" --non-interactive --trust-server-cert --username [username] --password [password] --config-dir [subversionDirectory]

The code to create the same process (ProcessStartInfo) is:

process.StartInfo = new ProcessStartInfo
                        {
                                CreateNoWindow = true,
                                UseShellExecute = false,
                                RedirectStandardOutput = true,
                                RedirectStandardError = true,
                                FileName = executableLocation,
                                WindowStyle = ProcessWindowStyle.Hidden,
                                Arguments = commandParameters
                        };

The code side is in a web service that is using impersonation for the same user that is in the [username] in the command; the cmd side I've done a runas to run as the same user that is in the [username] in the command.

It should also be noted that when the command is "status" instead of "update" that it seems to work on both, however the update works in CMD but fails on the code side.

What would make one process succeed while the other fails (this is consistent, from cmd it always works and from process in code it always fails)? I'm at a bit of a loss as to what to look at next to resolve this issue.

ChrisHDog
  • 4,473
  • 8
  • 51
  • 77
  • 1
    You really should post some code... However, it looks like a permissions issue to me. Where does this code run? In a console app? A web server? Something else? E.g. Is your console (cmd) running with the same user as your app? Are you running one with elevated privileges, but not the other? – spender Dec 14 '16 at 01:23
  • The code is run via a web service (i.e. call the web service and it runs the System.Diagnostics.Process). On the web service the web.config impersonates a user, in the cmd I've done a runas to be the same user (so should be same user in both instances) – ChrisHDog Dec 14 '16 at 01:30
  • This looks highly relevant: http://stackoverflow.com/questions/4624113/start-a-net-process-as-a-different-user – spender Dec 14 '16 at 01:41
  • Thanks, though it looks is if it is already running as that user (as evident by the message/response I'm getting on both the CMD and Process methods) – ChrisHDog Dec 14 '16 at 01:57

0 Answers0