Unable to start appium server as ServiceUrl appends /wd/hub/

Using C# .Net to programmatically build and start appium

AppiumLocalService got this

public Uri ServiceUrl => new Uri($“http://{IP.ToString()}:{Convert.ToString(Port)}/wd/hub”);
which makes ServiceUrl - “
Then it times out as the serviceUrl is incorrect

But my Appium server got only
[Appium] (only accessible from the same host)

There’s not really enough information here to know what’s wrong. But it sounds like you are using Appium V1.x I’d suggest moving to version 2 as 1 is no longer supported as far as I know. Appium 2 doesn’t require the wd/hub.

Sorry , using Appium 2

C# code to construct builder
var builder = new AppiumServiceBuilder();

                    .WithAppiumJS(new FileInfo("C:\\Users\\*****\\AppData\\Roaming\\npm\\node_modules\\appium\\build\\lib\\main.js"))
                    .UsingDriverExecutable(new FileInfo("C:\\Program Files\\nodejs\\node.exe"))

                    .WithLogFile(new FileInfo(Path.GetTempPath() + "Log.txt")).Build();

serviceurl returns “”

ServiceUrl automatically appends /wd/hub, if this can be removed , then I may be able to start the server

But this is read only in AppiumLocalService class

I son’t use AppiumServiceBuilder myself but I did some quick research.

I think you need to set the base path argument. Seems like it’s defaulting to /wd/hub Try something like this:

var b = new AppiumServiceBuilder();
OptionCollector argCollector = new OptionCollector().AddArguments(new KeyValuePair<string, string>("--base-path", "/"));
 var localService = b.WithIPAddress("").WithArguments(argCollector);

I don’t have time to try it out myself so you may need to modify a little.

Your appium client nuget is too old.
Either get the 5.x version or use the --base-path argument for the local service

Sorry , I can see the latest stable as 4.5.

Are you referring to something else?

I tried adding arguments , with --basepath

and with callbackaddress. no luck .


it still appends “/wd/hub/”

I can see ServiceUrl in the AppiumLocalService class ,

[HTTP] --> GET /wd/hub/status
[HTTP] {}
[HTTP] No route found for /wd/hub/status
[HTTP] <-- GET /wd/hub/status 404 7 ms - 211

To update Appium.Webdriver package to 5.x you need to include pre-release packages.

In the code you provide I can’t see anywhere you are setting --base-path argument. I believe you need something like

AddArguments(new KeyValuePair<string, string>("--base-path", "/"))

1 Like

yep , I added the value

.AddArguments(new KeyValuePair<string, string>("–base-path", “/”))
But still the ServiceUrl appended with “/wd/hub” .

localservice args value ->
“C:\Users*\AppData\Roaming\npm\node_modules\appium\build\lib\main.js" --port “4723” --address “” --log "C:\Users*\AppData\Local\Temp\Log.txt” –base-path /

Thank you . The issue got fixed by adding -pa instead of basepath

AddArguments(new KeyValuePair<string, string>("-pa", “/wd/hub”));


Thanks @santhi ! It helped as well in my case