Reputation: 1
When calling the xxxxxxxx.azurewebsites.net, the following appears in the browser console. Can anyone help. Thanks.
blazor.webassembly.js:1 System.InvalidOperationException: A suitable constructor for type 'Microsoft.Extensions.Logging.LoggerFactory' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite (Microsoft.Extensions.DependencyInjection.ServiceLookup.ResultCache lifetime, System.Type serviceType, System.Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) <0x1ef0ee0 + 0x00086> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact (Microsoft.Extensions.DependencyInjection.ServiceDescriptor descriptor, System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain, System.Int32 slot) <0x1ee9cc0 + 0x000f2> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) <0x1ee9878 + 0x00034> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) <0x1ee91b0 + 0x0005a> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory+<>c__DisplayClass7_0.<GetCallSite>b__0 (System.Type type) <0x1ee8ce8 + 0x00010> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) <0x1ed0ea0 + 0x0006c> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteChain callSiteChain) <0x1ed0d28 + 0x00040> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor (System.Type serviceType) <0x1ed0790 + 0x00018> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) <0x1ed0018 + 0x0006c> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService (System.Type serviceType, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngineScope) <0x1ecfdd8 + 0x00024> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService (System.Type serviceType) <0x1ee8c18 + 0x00020> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService (System.IServiceProvider provider, System.Type serviceType) <0x1ecf710 + 0x00062> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T] (System.IServiceProvider provider) <0x1ee8b20 + 0x0001e> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHost.RunAsyncCore (System.Threading.CancellationToken cancellationToken) <0x1ee81e0 + 0x0016a> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at TakeOut.Client.Program.Main (System.String[] args) <0x1e12b18 + 0x00152> in <filename unknown>:0
(anonymous) @ blazor.webassembly.js:1
blazor.webassembly.js:1 at Microsoft.AspNetCore.Components.WebAssembly.Hosting.EntrypointInvoker.InvokeEntrypoint (System.String assemblyName, System.String[] args, Microsoft.AspNetCore.Components.WebAssembly.Hosting.SatelliteResourcesLoader satelliteResourcesLoader) <0x1d29ea8 + 0x001d6> in <filename unknown>:0
The client project:
-PropertyGroup-
-TargetFramework-netstandard2.1-/TargetFramework-
-RazorLangVersion-3.0-/RazorLangVersion-
-ServiceWorkerAssetsManifest-service-worker-assets.js-/ServiceWorkerAssetsManifest-
-/PropertyGroup-
-ItemGroup-
-PackageReference Include="Blazored.LocalStorage" Version="2.1.5" /-
-PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview5.20216.8" /-
-PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview5.20216.8" PrivateAssets="all" /-
-PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0-preview5.20216.8" PrivateAssets="all" /-
-PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.2.0-preview2.20160.5" /-
-PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.4" /-
-/ItemGroup-
-ItemGroup-
-ProjectReference Include="..\Shared\TakeOut.Shared.csproj" /-
-/ItemGroup-
-!-- When publishing, swap service-worker.published.js in place of service-worker.js ---
-ItemGroup Condition="'$(DesignTimeBuild)' != 'true'"-
-Content Remove="wwwroot\service-worker.js" /-
-Content Update="wwwroot\service-worker.published.js" Link="wwwroot\service-worker.js" /-
-/ItemGroup-
-ItemGroup-
-Folder Include="wwwroot\Images\" /-
-/ItemGroup-
</Project>
The server project:
-Project Sdk="Microsoft.NET.Sdk.Web"-
-PropertyGroup-
-TargetFramework-netcoreapp3.1-/TargetFramework-
-DisableImplicitComponentsAnalyzers-true-/DisableImplicitComponentsAnalyzers-
-/PropertyGroup-
-ItemGroup-
-PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.0-preview5.20216.8" /-
-PackageReference Include="Microsoft.Azure.Cosmos" Version="3.8.0" /-
-PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" /-
-/ItemGroup-
-ItemGroup-
-ProjectReference Include="..\Client\TakeOut.Client.csproj" /-
-ProjectReference Include="..\Shared\TakeOut.Shared.csproj" /-
-/ItemGroup-
-/Project-
Upvotes: 0
Views: 734
Reputation: 599
I've got this error while migrating the blazor application to .net6. Installing Hosting Bundle Installer on application server, resolved the issue.
Upvotes: 0
Reputation: 1
I updated all my code the the release version of the web assembly which gave no error in development mode on my pc but errors when publising it to azure.
The problem was with Microsoft.AspNetCore.SignalR.Client in the web assembly. Removing the package and code related to the package did not generate any errors.
I fixed the problem by using the javascript SignalR in my web assembly. It works but I would have prefer to use the package SignalR and the C# code to handle the connection instead of using javascript.
Note: I tried the package with only a web assembly (instead of a hosted web assembly). Same errors with the package when published to azure.
Upvotes: 0
Reputation: 282
This looks like a linker issue. Does it work if you disable linking?
<PropertyGroup>
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>
Also you are using the older (Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview5.20216.8") version of WebAssembly.
I would suggest to upgrade to latest version.
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0" />
You may also try clearing cached files locally.
Upvotes: 1