Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting an app in non-default database causes exception #76

Open
joozek78 opened this issue Nov 20, 2018 · 2 comments
Open

Starting an app in non-default database causes exception #76

joozek78 opened this issue Nov 20, 2018 · 2 comments
Assignees

Comments

@joozek78
Copy link
Contributor

Starcounter.DbException: ScErrFailingEntrypoint (SCERR4259): The user code entrypoint method raised an exception. System.ArgumentException: Handler relative URI: "/useradmin\useradmin/starcounter.authorization.redirection.html" is ill formed. Please consult RFC 3986 for more information.

This is caused by this line. Application.ToString() prepends database name with a backslash, but only if database is not default. The backslash causes the exception, but illegal characters in db name could also cause trouble.

@joozek78 joozek78 self-assigned this Nov 20, 2018
@joozek78 joozek78 added the bug label Nov 20, 2018
@warpech
Copy link

warpech commented Mar 26, 2019

I can confirm the problem still exists:

Starcounter.DbException: ScErrFailingEntrypoint (SCERR4259): The user code entrypoint method raised an exception. System.ArgumentException: Handler relative URI: "/mydatabase\blendingeditor/starcounter.authorization.redirection.html" is ill formed. Please consult RFC 3986 for more information.
   at Starcounter.Rest.UriManagedHandlersCodegen.GenerateParsingDelegateAndGetParameters(String methodSpaceUri, MethodInfo userDelegateInfo, Expression delegExpr, Byte[]& nativeParamTypes, Type& dbObjectType, Type& argMessageType, Type& argSessionType) in C:\ c_work\sc-19997\Level1\src\Starcounter.Rest\UriManagedHandlersCodegen.cs:line 727
   at Starcounter.Rest.UriManagedHandlersCodegen.RegisterDelegate(UInt16 port, String methodSpaceUri, MethodInfo userDelegateInfo, Expression delegExpr, NetworkProtocolType protoType, HandlerOptions ho) in C:\       c_work\sc-19997\Level1\src\Starcounter.Rest\UriManagedHandlersCodegen.cs:line 653
   at Starcounter.Rest.UriManagedHandlersCodegen.GenerateParsingDelegate(UInt16 port, String methodSpaceUri, Func`1 userDelegate, HandlerOptions ho, NetworkProtocolType protoType) in C:\      c_work\sc-19997\Level1\src\Starcounter.Rest\UriManagedHandlersCodegen.cs:line 919
   at Starcounter.Handle.GET(String uriTemplate, Func`1 code, HandlerOptions ho) in C:\ c_work\sc-19997\Level1\src\Starcounter.Internal\Handle.GET.cs:line 115
   at Starcounter.Authorization.Authentication.AuthenticationStartupFilter.RegisterHtmlPage(String uri, String content)
   at Starcounter.Authorization.Authentication.AuthenticationStartupFilter.<>c__DisplayClass6_0.<Configure>b__0(IApplicationBuilder app)
   at Starcounter.Authorization.Settings.EnsureSettingsStartupFilter`1.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Starcounter.Startup.DefaultStarcounterBootstrapper.Start(IStartup application)
   at BlendingEditor.Program.Main(String[] args)
   at Starcounter.Hosting.Package.ExecuteEntryPoint(Application application, Assembly assembly) in C:\  c_work\sc-19997\Level1\src\Starcounter.Hosting\Hosting\Package.cs:line 556
Version: 2.4.990.243.
Help page: https://docs.starcounter.io/?q=SCERR4259.
   at Starcounter.Hosting.Package.ExecuteEntryPoint(Application application, Assembly assembly) in C:\  c_work\sc-19997\Level1\src\Starcounter.Hosting\Hosting\Package.cs:line 566
   at Starcounter.Hosting.Package.ProcessWithinCurrentApplication(Application application, ApplicationDirectory applicationDir) in C:\  c_work\sc-19997\Level1\src\Starcounter.Hosting\Hosting\Package.cs:line 262
   at Starcounter.Hosting.Package.Process() in C:\      c_work\sc-19997\Level1\src\Starcounter.Hosting\Hosting\Package.cs:line 134
   at Starcounter.Hosting.Package.Process(IntPtr hPackage) in C:\       c_work\sc-19997\Level1\src\Starcounter.Hosting\Hosting\Package.cs:line 53
   at StarcounterInternal.Hosting.Processor.RunMessageLoop(Void* hsched) in C:\ c_work\sc-19997\Level1\src\Starcounter.Hosting\StarcounterInternal.Hosting\Processor.cs:line 90
ErrorCode=4259
HResult=-2146233088
HelpLink=https://docs.starcounter.io/?q=SCERR4259
---> System.ArgumentException: Handler relative URI: "/mydatabase\blendingeditor/starcounter.authorization.redirection.html" is ill formed. Please consult RFC 3986 for more information.
   at Starcounter.Rest.UriManagedHandlersCodegen.GenerateParsingDelegateAndGetParameters(String methodSpaceUri, MethodInfo userDelegateInfo, Expression delegExpr, Byte[]& nativeParamTypes, Type& dbObjectType, Type& argMessageType, Type& argSessionType) in C:\ c_work\sc-19997\Level1\src\Starcounter.Rest\UriManagedHandlersCodegen.cs:line 727
   at Starcounter.Rest.UriManagedHandlersCodegen.RegisterDelegate(UInt16 port, String methodSpaceUri, MethodInfo userDelegateInfo, Expression delegExpr, NetworkProtocolType protoType, HandlerOptions ho) in C:\       c_work\sc-19997\Level1\src\Starcounter.Rest\UriManagedHandlersCodegen.cs:line 653
   at Starcounter.Rest.UriManagedHandlersCodegen.GenerateParsingDelegate(UInt16 port, String methodSpaceUri, Func`1 userDelegate, HandlerOptions ho, NetworkProtocolType protoType) in C:\      c_work\sc-19997\Level1\src\Starcounter.Rest\UriManagedHandlersCodegen.cs:line 919
   at Starcounter.Handle.GET(String uriTemplate, Func`1 code, HandlerOptions ho) in C:\ c_work\sc-19997\Level1\src\Starcounter.Internal\Handle.GET.cs:line 115
   at Starcounter.Authorization.Authentication.AuthenticationStartupFilter.RegisterHtmlPage(String uri, String content)
   at Starcounter.Authorization.Authentication.AuthenticationStartupFilter.<>c__DisplayClass6_0.<Configure>b__0(IApplicationBuilder app)
   at Starcounter.Authorization.Settings.EnsureSettingsStartupFilter`1.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Starcounter.Startup.DefaultStarcounterBootstrapper.Start(IStartup application)
   at BlendingEditor.Program.Main(String[] args)
   at Starcounter.Hosting.Package.ExecuteEntryPoint(Application application, Assembly assembly) in C:\  c_work\sc-19997\Level1\src\Starcounter.Hosting\Hosting\Package.cs:line 556
HResult=-2147024809

@miyconst
Copy link
Member

The fix is trivial. Starcounter.Application has the following structure when started in custom database.

{
  "Host": {},
  "Name": "Playground",
  "DisplayName": "custom\\Playground",
  "FullName": "custom\\Playground",
  "FilePath": "D:\\GitHub\\Miyconst\\Playground\\Playground\\bin\\Debug\\Playground.exe",
  "WorkingDirectory": "D:\\GitHub\\Miyconst\\Playground\\Playground",
  "ResourceDirectories": [],
  "Arguments": null
}

So, this would fix the issue:

-public string RedirectionViewUri => $"/{Application.Current}/Starcounter.Authorization.Redirection.html";
+public string RedirectionViewUri => $"/{Application.Current.Name}/Starcounter.Authorization.Redirection.html";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants