I have created a new .NET Core MVC application in Visual Studio 2017 and enabled multi-tenant authentication.
I've completed the configuration (ClientId, Authority, etc) but when I debug the application there is an exception in the Startup.cs, specifically the app.useOpenIdConnectAuthentication
method.
The exception given is
System.ArgumentException: The path in 'value' must start with '/'.
I'm a bit of a novice when it comes to C# and .NET Core, so I'm not sure whether I'm missing something obvious. The main sticking point is what the debugger is referring to with the parameter 'value' as I can't see any mention of it in the code. There are no changes beyond the default template generated by visual studio, other than adding the configuration items to the appsettings.json.
As there is no code in the question, so I will try to make general answer as possible.
The previous exception appears when you use this overload
PathString.FromUriComponent(string)
and the string does not start with the/
characterso,for example, the following code will throw an exception :
and to fix the previous exception you can write it like this
and of course, this will be a relative path.
In case you wanted to write an absolute path, (and not start your string with
/
), then you must use another overload of this method which takesUri
instead ofstring
here is an example
I also had a similar issue:
The error was:
Fixed by replacing
with
Also you can try deploying with
and find the error if any.