Nav 2018 web client an error has occurred

Question Status

Suggested Answer
PhilD asked a question on 11 Dec 2017 11:34 AM

The rtc is working fine on a service tier. I have created a new service tier and used new- The json file has been edited to use navuserpassword and  when the browser is run the credentials are entered but the message "An error has occurred" is displayed"

The event log shows 

Error accessing Website
Raw Url:
Url:
Type: Microsoft.Dynamics.Nav.Types.NavServerNotFoundException
Message: A server was not found at "net.tcp://nav2018demo:9046/web/Service". Either the URL is incorrect or the server is currently not available.
StackTrace:
at Microsoft.Dynamics.Nav.Client.ConnectionEstablisher.ConfirmOpenConnectionRetry(ConnectFailedEventArgs connectFailedArgs, Exception exception) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.ServiceConnection\ConnectionEstablisher.cs:line 658
at Microsoft.Dynamics.Nav.Client.ConnectionEstablisher.OpenConnection[TChannel](ConnectFailedEventArgs connectFailedArgs, ConnectionRequest connectionRequest, ConnectionOptions connectionOptions, SpnSetting spnSettingToTry, Boolean allowSpnSettingsSwap, UserSettings& userSettings) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.ServiceConnection\ConnectionEstablisher.cs:line 482
at Microsoft.Dynamics.Nav.Client.ConnectionEstablisher.OpenConnection[TChannel](ConnectionRequest connectionRequest, ConnectionOptions connectionOptions, UserSettings& userSettings) in S:\Depot\NAV110\Platform\Client\Shared\Prod.Client.ServiceConnection\ConnectionEstablisher.cs:line 216
at Microsoft.Dynamics.Nav.Client.Web.SimpleServerOperation.SimpleServerOperationConnectionEstablisher.OpenConnection[TChannel](ConnectionRequest connectionRequest, ConnectionOptions connectionOptions, UserSettings& userSettings) in S:\Depot\NAV110\Platform\Client\Web\Prod.Client.WebCommon\Security\SimpleServerOperation.cs:line 151
at Microsoft.Dynamics.Nav.Client.Web.SimpleServerOperation.ExecuteCore[TResult,TChannel](RequestContext requestContext, ConnectionOptions serverConnectionOptions, Func`2 operation, Func`3 operationWithContext, Func`2 localExceptionHandler) in S:\Depot\NAV110\Platform\Client\Web\Prod.Client.WebCommon\Security\SimpleServerOperation.cs:line 295
at Microsoft.Dynamics.Nav.Client.Web.SimpleServerOperation.Execute[TResult,TChannel](RequestContext requestContext, ConnectionOptions serverConnectionOptions, Func`2 operation, Func`2 localExceptionHandler) in S:\Depot\NAV110\Platform\Client\Web\Prod.Client.WebCommon\Security\SimpleServerOperation.cs:line 207
at Microsoft.Dynamics.Nav.Client.Web.UserValidator.ValidateUser(RequestContext requestContext) in S:\Depot\NAV110\Platform\Client\Web\Prod.Client.WebCommon\Security\UserValidator.cs:line 60
at Prod.Client.WebCoreApp.Authentication.UserPasswordAuthenticationProvider.<Authenticate>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Dynamics.Nav.WebClient.Controllers.AuthenticationController.<SignIn>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()
Source: Microsoft.Dynamics.Nav.Client.ServiceConnection----------------------------------
Type: System.Net.Sockets.SocketException
Message: An existing connection was forcibly closed by the remote host
StackTrace:
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

Reply
Roberto Stefanetti responded on 17 Dec 2017 4:23 AM

hi,

is a new installation ? there are other active installations on your IIS ?  ex: old Web Clients, Old NAv Help Servers etc...), try to remove before installa NAV 2018 web client in this case.

Also try to call NAV Web Client using standard statement: localhost/.../WebClient (run on your nav server).

Check IIS connection pool (can be inactive)

Check if you have correct Connection Pool on IIS for NAV 2018 Web Client.

Reply
PhilD responded on 19 Dec 2017 9:53 AM

This is a new server set up specifically for Nav 2018 installation. There has been no other NAV on this server.

Reply
PhilD responded on 19 Dec 2017 9:59 AM

Using localhost/.../webclient gives 'Sorry, that didn't work An error occurred'

App pool is running and has the correct virtual app applied to it.

Using the same tests on the other service tiers that uses Windows Auth works fine.

Reply
PhilD responded on 20 Dec 2017 9:37 AM

After spending hours looking thru google and contemplating the issue I finally resorted to opening a case with MS. Mohamad in Dubai was very experienced and told me that MS has had some issues with credentials but rest assured he could work thru the issues and fix it! 

Well, he was very knowledgeable and we had a shared session to go over the possible issues. It is now working and I have listed some notes below that might help anyone else. Mohamad also agreed with me that the setup in NAV 2018 is not as good as it should be and it leaves a lot of the setup steps out meaning the result is a nonworking NAV. The good news is that in 2 versions from now there will be no GUI and Powershell will do all the work lol!

In my case, I had created a new service tier for my web client tests that I want to user NavUserPassword for and still had the original one in place and working using Windows Credentials. I was also just setting this up for testing and development so it is a workgroup server and not a member of an AD. The original service tier is the default one. Bear this in mind. NAV2018 uses Web core and the web.config is stripped out into navsettings.json where the server instance credentials etc are now for the web client. This is not a detailed step by step guide as I assume you are well versed with Windows tools.

Steps for NavUserPassword in NAV 2018
Change service account of new service tier to domain user account and add this new account to the local admins group
place public (I did not use a self-generated ssl cert) SSL cert in trusted store, as well as personal using MMC with cert store loaded
right click SSL in personal all tasks and manage private key - give rights to nav tier service account
Run new-navwebinstance to create web virtual directory if it does not get created when you create the new service tier
Check that the website in IIS manager is set to the app pool with the name of the new virtual folder created in IIS and that the pool is set to no managed code if not change this
Set login in SQL for new nav service tier service account with sysadmin rights
Check navsettings.json file in wwwroot, for the website, has the correct server/instance/ports and credential type as this will default to the same as the initial service tier
restart IIS when changes are made
restart nav service tier

You may need to use netsh http show urlacl  to check the service tier ports are there. 

The above is a bit of a brain dump so some of this may be a little off base but I hope it is enough to get you thru.

Reply
Suggested Answer
Hennie Bink responded on 16 May 2018 1:43 PM

I had the same problem.

I changed in navsettings.json the Server setting from the external URL to localhost.

New correct setting: "Server":  "localhost"

Problem solved.

I added a new WebServerInstance with PowerShell "New-NAVWebServerInstance" and used the external URL for param -Server instead of localhost.

Reply
Suggested Answer
Hennie Bink responded on 16 May 2018 1:43 PM

I had the same problem.

I changed in navsettings.json the Server setting from the external URL to localhost.

New correct setting: "Server":  "localhost"

Problem solved.

I added a new WebServerInstance with PowerShell "New-NAVWebServerInstance" and used the external URL for param -Server instead of localhost.

Reply