blogifierdotnet / Blogifier

Blogifier is an open-source publishing platform Written in ASP.NET and Blazor WebAssembly. With Blogifier make a personal blog or a website.
https://blogifier.net
MIT License
1.28k stars 518 forks source link

Deploy blogifier to Azure APP #130

Closed MohitVerma-MSFT closed 5 years ago

MohitVerma-MSFT commented 5 years ago

I am trying to deploy blogifier app to azure app and i have used sql server ef migration for the DB purpose. After successful deplyment when i am trying to access the site then i am getting 500 error:-

Error message:-
Hosting startup assembly exception System.InvalidOperationException: Startup assembly StartupBootstrapper failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'StartupBootstrapper, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) --- End of inner exception stack trace --- 2019-02-06 13:30:30.204 +00:00 [Error] Connection id ""0HLKC6S0SNTES"", Request id ""0HLKC6S0SNTES:00000001"": An unhandled exception was thrown by the application. System.InvalidOperationException: A view component named 'HtmlBlock' could not be found. A view component must be a public non-abstract class, not contain any generic parameters, and either be decorated with 'ViewComponentAttribute' or have a class name ending with the 'ViewComponent' suffix. A view component must not be decorated with 'NonViewComponentAttribute'. at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeAsync(String name, Object arguments) at AspNetCore.Views_Themes_StandardSharedHeader.ExecuteAsync() in D:\home\site\wwwroot\Views\Themes\Standard_Shared_Header.cshtml:line 11 at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts) at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context) at Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper.RenderPartialViewAsync(TextWriter writer, Object model, IView view) at Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output) at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.RunAsync(TagHelperExecutionContext executionContext) at AspNetCore.Views_Themes_Standard_List.<>c__DisplayClass19_0.<b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() at AspNetCore.Views_Themes_Standard_List.ExecuteAsync() in D:\home\site\wwwroot\Views\Themes\Standard\List.cshtml:line 11 at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts) at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable1 statusCode) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable1 statusCode) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result) at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync[TFilter,TFilterAsync]() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

rxtur commented 5 years ago

Did you try to build and test locally as described here? And if it works locally - deploy published output to Azure and verify it works?

Tank6035 commented 5 years ago

I am also getting a 500 error after publishing to Azure. I followed the Build instruction and it works fine locally. The interesting things the admin portal loads fine.

jwmxyz commented 5 years ago

I am also getting a 500 error after publishing to Azure. I followed the Build instruction and it works fine locally. The interesting things the admin portal loads fine.

Same thing is happening to me also - looking into it now

rxtur commented 5 years ago

Looks like this is because publishing to Azure does not include Common.dll into deployment. This DLL does not have reference to application, because it is plugin example and loads dynamically. So to fix this:

abieganski commented 5 years ago

If you edit App.csproj and add plugins\Common\Common.csproj as a project reference (and mark it as "Copy Local"), Common.dll will get copied over automatically when running dotnet publish.

  <ItemGroup>
    <ProjectReference Include="..\..\plugins\Common\Common.csproj">
      <Private>true</Private>
    </ProjectReference>
    <ProjectReference Include="..\Core\Core.csproj" />
  </ItemGroup>
rxtur commented 5 years ago

If you edit App.csproj and add plugins\Common\Common.csproj as a project reference (and mark it as "Copy Local"), Common.dll will get copied over automatically when running dotnet publish.

Yes, but this would defeat its purpose - to demonstrate plugin that will be loaded dynamically at runtime without having to reference in the application.

abieganski commented 5 years ago

If you edit App.csproj and add plugins\Common\Common.csproj as a project reference (and mark it as "Copy Local"), Common.dll will get copied over automatically when running dotnet publish.

Yes, but this would defeat its purpose - to demonstrate plugin that will be loaded dynamically at runtime without having to reference in the application.

Sure. Thing is it took me a couple of days to figure out why I kept getting the "System.InvalidOperationException: A view component named 'HtmlBlock' could not be found." error :)

rxtur commented 5 years ago

In the latest update, plugins/common project referenced in the application and should be included in the build for deployment.