fsbolero / Bolero

Bolero brings Blazor to F# developers with an easy to use Model-View-Update architecture, HTML combinators, hot reloaded templates, type-safe endpoints, advanced routing and remoting capabilities, and more.
https://fsbolero.io
Apache License 2.0
1.06k stars 53 forks source link

[support] can't deploy to IIS #228

Closed giuliohome closed 3 years ago

giuliohome commented 3 years ago

Installed .NET Core

F:\Appl\bolero>dotnet --version
5.0.400

tried installing templates

F:\Appl\bolero>dotnet new -i Bolero.Templates
Template Name                                 Short Name           Language    Tags
--------------------------------------------  -------------------  ----------  ----------------------
Console Application                           console              [C#],F#,VB  Common/Console
Class library                                 classlib             [C#],F#,VB  Common/Library
WPF Application                               wpf                  [C#],VB     Common/WPF
WPF Class library                             wpflib               [C#],VB     Common/WPF
WPF Custom Control Library                    wpfcustomcontrollib  [C#],VB     Common/WPF
WPF User Control Library                      wpfusercontrollib    [C#],VB     Common/WPF
Windows Forms App                             winforms             [C#],VB     Common/WinForms
Windows Forms Control Library                 winformscontrollib   [C#],VB     Common/WinForms
Windows Forms Class Library                   winformslib          [C#],VB     Common/WinForms
Worker Service                                worker               [C#],F#     Common/Worker/Web
MSTest Test Project                           mstest               [C#],F#,VB  Test/MSTest
NUnit 3 Test Item                             nunit-test           [C#],F#,VB  Test/NUnit
NUnit 3 Test Project                          nunit                [C#],F#,VB  Test/NUnit
xUnit Test Project                            xunit                [C#],F#,VB  Test/xUnit
Razor Component                               razorcomponent       [C#]        Web/ASP.NET
Razor Page                                    page                 [C#]        Web/ASP.NET
MVC ViewImports                               viewimports          [C#]        Web/ASP.NET
MVC ViewStart                                 viewstart            [C#]        Web/ASP.NET
Blazor Server App                             blazorserver         [C#]        Web/Blazor
Blazor WebAssembly App                        blazorwasm           [C#]        Web/Blazor/WebAssembly
ASP.NET Core Empty                            web                  [C#],F#     Web/Empty
ASP.NET Core Web App (Model-View-Controller)  mvc                  [C#],F#     Web/MVC
ASP.NET Core Web App                          webapp               [C#]        Web/MVC/Razor Pages
ASP.NET Core with Angular                     angular              [C#]        Web/MVC/SPA
ASP.NET Core with React.js                    react                [C#]        Web/MVC/SPA
ASP.NET Core with React.js and Redux          reactredux           [C#]        Web/MVC/SPA
Razor Class Library                           razorclasslib        [C#]        Web/Razor/Library
ASP.NET Core Web API                          webapi               [C#],F#     Web/WebAPI
ASP.NET Core gRPC Service                     grpc                 [C#]        Web/gRPC
dotnet gitignore file                         gitignore                        Config
global.json file                              globaljson                       Config
NuGet Config                                  nugetconfig                      Config
Dotnet local tool manifest file               tool-manifest                    Config
Web Config                                    webconfig                        Config
Solution File                                 sln                              Solution
Protocol Buffer File                          proto                            Web/gRPC

Examples:
    dotnet new mvc --auth Individual
    dotnet new react --auth Individual
    dotnet new --help
    dotnet new gitignore --help

but it doesn't work

F:\Appl\bolero>dotnet new bolero-app -o MyApp
No templates found matching: 'bolero-app'.
To list installed templates, run 'dotnet new --list'.
To search for the templates on NuGet.org, run 'dotnet new bolero-app --search'.

Actually I can search the template and it is there

F:\Appl\bolero>dotnet new bolero-app --search
Searching for the templates...
Matches from template source: NuGet.org

Template Name              Short Name  Author          Language  Package           Downloads
-------------------------  ----------  --------------  --------  ----------------  ---------
Bolero Hosted Application  bolero-app  IntelliFactory  F#        Bolero.Templates        14k

To use the template, run the following command to install the package: dotnet new -i <package>
Example:
        dotnet new -i Bolero.Templates

but I can't install it or where am I going wrong?

Thank you

giuliohome commented 3 years ago

conn errors are not shown

granicz commented 3 years ago

@giuliohome Did you find out what was wrong?

giuliohome commented 3 years ago

Yes, it was an issue of my virtual machine in my cloud. The certificate authority of DigiCert Assured ID Root CA was missing. I manually installed from url as explained here and I have asked my cloud sys admin if they can configure the template for our virtual machines so that it is included in the creation phase.

Anyway, all fine with Bolero AFAICS, not an issue of this repository, thank you

giuliohome commented 3 years ago

@granicz by the way, how can I publish the 2 Bolero projects Server and Client under one IIS application? I've tried publishing only the server but it's not clear to me how to mix the 2 web.config (and all the rest if needed) from the client and the server parts.

giuliohome commented 3 years ago

I see that I have to put the application at root level (but how to publish under an application virtual path?) and I have to install the .NET Core Hosting Bundle and the url rewrite for IIS but I still can't make the counter go up and down with the buttons (under IIS, for sure it works with vanilla dotnet run..)... it is also true that it is quite slow for the first activation, but ,aside from that, I think there is something else to do for IIS...

giuliohome commented 3 years ago

Reopening the issue under a different title "[support] can't deploy to IIS": no problem with dotnet run but my doubts are about the IIS deploy. Is the project server the only supposed to be published under IIS ? It makes sense (also because we need to have a single client - server application so I would expect a single project to be deployed under IIS) but how to include all the client specific configuration settings that are missing in the web.config of the server project? Aren't they needed? In any case, at the moment I'm not able to run the template sample and the two Bolero client apps in it from IIS (under Windows Server 2019). Any documentation, tutorial or at least a link or a suggestion? Thanks in advance

giuliohome commented 3 years ago

I'm having a similar issue on Linux after I dotnet publish if I try to dotnet MyApp.Server.dll I get a 404 for blazor.webassembly.js

Request finished HTTP/1.1 GET http://localhost:5100/_framework/blazor.webassembly.js - - - 404 0 - 0.8376ms

giuliohome commented 3 years ago

I'm having a similar issue on Linux after I dotnet publish if I try to dotnet MyApp.Server.dll I get a 404 for blazor.webassembly.js

Understood, the above is fixed by running the dll under net5.0 and not under publish folder!

Notice the strange configuration below, but it does the trick on Linux, the ExecStart is not from the publish dir...

[Service]
WorkingDirectory=/home/giuliohome/dev/net/fsbolero/MyApp/src/MyApp.Server/bin/Release/net5.0/publish
ExecStart=/usr/bin/dotnet /home/giuliohome/dev/net/fsbolero/MyApp/src/MyApp.Server/bin/Release/net5.0/MyApp.Server.dll

I wonder whether it is standard, and I guess it can be a problem for IIS that is going to read just the published folder...

giuliohome commented 3 years ago

I'm having a similar issue on Linux after I dotnet publish if I try to dotnet MyApp.Server.dll I get a 404 for blazor.webassembly.js

Understood, the above is fixed by running the dll under net5.0 and not under publish folder!

Notice the strange configuration below, but it does the trick on Linux, the ExecStart is not from the publish dir...

[Service]
WorkingDirectory=/home/giuliohome/dev/net/fsbolero/MyApp/src/MyApp.Server/bin/Release/net5.0/publish
ExecStart=/usr/bin/dotnet /home/giuliohome/dev/net/fsbolero/MyApp/src/MyApp.Server/bin/Release/net5.0/MyApp.Server.dll

I wonder whether it is standard, and I guess it can be a problem for IIS that is going to read just the published folder...

Now I've understood why! I've had to manually copy MyApp.Server.StaticWebAssets.xml from net5.0 to the publish folder (of course it is a bug in some config template that it was not already there), and it contains the references

<StaticWebAssets Version="1.0">
<ContentRoot BasePath="/" Path="/home/giuliohome/dev/net/fsbolero/MyApp/src/MyApp.Client/bin/Release/net5.0/wwwroot/"/>
<ContentRoot BasePath="/" Path="/home/giuliohome/dev/net/fsbolero/MyApp/src/MyApp.Client/wwwroot/"/>
</StaticWebAssets>

needed for the Blazor client apps to run

giuliohome commented 3 years ago

Or - another neat solution, but still manual so I guess you have a bug in the template somewhere - just copy the _framework folder from the Client to the Server wwwroot! (and no need to copy also MyApp.Server.StaticWebAssets.xml )

(I imagine the solution applies also to IIS, but I've no time to try atm.)