Reputation: 3186
I am using p4.net(perforce api for .net) to connect our perforce server and run some commands.
I have created a web service and and created a test call(ConnectToServer), when I test this web service on local(localhost:xxxx/project/test.asmx) it works perfectly, however, when I deploy my web service to out server and call the my "connect" web method, it comes up and says Unable to connect Perforce Server.
what is the difference between local and server, they both use same dlls to connect perforce, and they are both web service, why do you guys think it throws an error on server? is that configuration issue?
Upvotes: 2
Views: 746
Reputation: 2343
I would look deeper into how and where you actually set the Perforce connection parameters. As you say that the username property returns NETWORK_SERVICE, this indicates that that the Perforce user is not explicitly set, and falls back at attempting to use the current OS user.
Just to verify this: Try to set the relevant P4Connection properties such as User, Password and Port explicitly in the code immediately before connecting to the Perforce server. This should work unless you have any connectivity and/or protection issues between the web server and the Perforce server (which doesn't seem to be the case).
If the above works, and you believe that you were already doing this - is there a chance that you are setting up the properties for one P4Connection instance and using another for the actual connection attempt?
You also don't say how you attempt to set the credentials; do you attempt to use e.g. p4 set (which wouldn't work in this case) or environment variables (which would then need to set for the correct OS user or globally), or are you currently setting the P4Connection properties explicitly, or what?
Update: The poster was attempting to use P4HOST (or equivalent) instead of P4PORT, see comments below. There are still some unexpected results in the various tests performed as a result of the other replies, but all are probably related to the root problem.
Upvotes: 1
Reputation: 1
Can you check there is no firewall issues on the server? What is the exact error message from p4.net?
Upvotes: 0
Reputation: 3413
Which type of authentication / impersonation are you using in your web service web.config?
Which user does the service run under when on the remote server?
Does this user have sufficien access privileges for Perforce?
These would be my first questions.
Upvotes: 1