IIS 503 Service Unavailable

Hi,

I’ve followed the guide and video, but when browsing to the IIS-hosted site I get

Service Unavailable
HTTP Error 503. The service is unavailable.

  • Universal doesn’t create log files
  • IIS doesn’t log any requests in the log file
  • Another site is hosted on IIS and is working
  • All permissions for the service account are working. IIS path test passes. Running Universal.Server.exe as the service account works (though the admin login page loops).
  • Path to the DLL has been specified
  • C:\ProgramData\UniversalAutomation and C:\ProgramData\Universal Automation have been created and the service account has write permissions
  • Running on Server 2016, with IIS 10, .Net 4.7.2, websockets enabled, the app hosting bundle installed and the server restarted, windows auth installed but not enabled

What else can I try to fix this?

HEy @GSGBen, there are few different logs we can check - so let’s go overboard:

Universal is kind of chatty with logs and are currently in a few different places - they each tend to have their own function but like I said lets see what we have just in case :slight_smile:

Logs:

  • C:\ProgramData\PowerShellUniversal
  • C:\ProgramData\UniversalAutomation\logs
  • Your “Universal Folder” should also generate a “logs” folder -this is the actual application folder you should be trying to host.

Finally - there may even be something useful in the Event Viewer:
image

If there is something jumping out feel free to share here and we can help - otherwise you could pitch the logs over to adam @ poshtools.com and lee @ posthtools.com and we’ll take a look asap!

1 Like

@leeberg
I have found the issue, the problem is basically happened because the apppool stopped the moment you launch the site.

Based on event viewer logs the issue is related to apppool identity account.

This issue has been happened to me multiple times every time I update psu to new version

After further testing I found that if you change the apppool identity back to application pool identity everything works again but if switch the identity back to any custom account I have it will break again.
My current solution or workaround I have found to fix this is by uninstall IIS and reinstall and reinstall hosting bundle to get the apppool works again with custom domain account
It’s not practical every time you need to update to a new release to do all of this all over again

I’m surprised that’s happening as the PSU installer doesn’t do anything with IIS. Are you installing via MSI?

@adam
In my case am not using MSI installer, am downloading the .zip package and use that.

Thanks for your help and apologies for the delay. The logs showed that the App pool user needs to have “Log On as a Batch Job” rights (e.g. from secpol.msc > local policies > user rights assignment or GPO). Adding this got it started.

I now have a separate issue: The login page loads, but it loops back to it and doesn’t show the admin page. The \logs\log_.log file shows the errors

    fail: Universal.Server.Services.SecurityProxy[0]
        Failed to authenticate user.
    Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="failed to connect to all addresses")
    at Universal.Server.Services.SecurityProxy.AuthenticateAsync(String userName, String password) in E:\src\universal\src\Universal.Server\Services\SecurityProxy.cs:line 84

This is running on a server with 2 IPs, with the IIS site for this bound to one of the IPs only (so the server can host multiple HTTPS 443 services). This also occurs when using a different port with “all unassigned IPs”, and with HTTP. Changing the execution policy from RemoteSigned to Bypass doesn’t help either.

How can I resolve this?

Edit: found additional errors:

fail: Universal.Server.Services.DashboardAssetManager[0]
      The specified RequiredModules entry 'Universal' in the module manifest 'C:\inetpub\iotdeploymenttool\UniversalDashboard\Frameworks\v2\UniversalDashboard.psd1' is invalid. Try again after updating this entry with valid values.
fail: Universal.Server.Services.DashboardAssetManager[0]
      The specified RequiredModules entry 'Universal' in the module manifest 'C:\inetpub\iotdeploymenttool\UniversalDashboard\Frameworks\v3\UniversalDashboard.psd1' is invalid. Try again after updating this entry with valid values.

@GSGBen - What version are you running? In 1.2.1 or later we stopped launching the login services as a separate process by default to avoid this issue.

Thanks! Not that version. I’ll update when I’m back in the office and give it another go.

1 Like

Thanks, that (1.2.2) fixed it!

Logging into the admin portal is find, but starting a dashboard fails. This is the error in the universal log:

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.Exception: Failed to start dashboard.
   at Universal.Server.Services.DashboardProxy.Start(Dashboard dashboard) in E:\src\universal\src\Universal.Server\Services\DashboardProxy.cs:line 107
   at Universal.Server.Services.DashboardManager.Start(Dashboard dashboard) in E:\src\universal\src\Universal.Server\Services\DashboardManager.cs:line 60
   at UniversalAutomation.DashboardController.Start(Int64 id) in E:\src\universal\src\Universal.Server\Controllers\DashboardController.cs:line 151
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in E:\src\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 80
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

Dashboard is just the default one created when creating a new one.

There’s nothing in the dashboard Log tab. What next?

I have a couple Zoom calls with some folks tomorrow to look at a very similar issue. I’ll let you know what we find out! I’ll follow up tomorrow.

How’d you go?

@GSGBen - Sorry for not following up.

We had a couple different findings

First, make sure to Unblock-Files is extracting from the zip: Unable to Start Dashboard - 1.2.2 IIS

Second, make sure that if you have WebDav Publishing enabled on your machine it’s correctly configured to allow all verbs: Cannot remove or edit api's and identities after created

Finally, I would suggest that you have the latest version with the security fix from today: Security Bulletin – PowerShell Universal Role-Based Access Controls

If none of that applies and you still have this issue, let’s jump on a Zoom call and get this sorted.

Thanks for the quick fix on the Zoom call Adam.

For anyone else facing this: I needed to unblock the C:\ProgramData\PowerShellUniversal directory as well as the C:\inetpub<site> directory. All working now!