Skip to content

Commit

Permalink
issue #158: Fixed:
Browse files Browse the repository at this point in the history
Etter publisering må det kunne fungre å kjøre Blazor Geosynk Push på IIS.
Også teste publisering av Provider_Netcore.
  • Loading branch information
larseggan committed Oct 20, 2022
1 parent b0fd248 commit 16603d5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<Version>2.1.3</Version>
</PropertyGroup>

<ItemGroup>
<!--<ItemGroup>
<Content Remove="wwwroot\favicon.ico" />
</ItemGroup>
</ItemGroup>-->

<ItemGroup>
<None Remove="Old_favicon.ico" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<MudNavMenu Bordered="true" >
<MudNavLink Href="/" Match="NavLinkMatch.All" Icon="@Icons.Filled.Home">Home</MudNavLink>
<MudNavLink Href="" Match="NavLinkMatch.All" Icon="@Icons.Filled.Home">Home</MudNavLink>
@*<MudNavLink Href="/" Match="NavLinkMatch.All" Icon="@Icons.Filled.Home">Home</MudNavLink>*@
<MudNavGroup Title="Konfugurasjon" Expanded="true">
<MudNavLink Href="/servicesconfig" Match="NavLinkMatch.Prefix">Tilbyder</MudNavLink>
<MudNavLink Href="/subscribers" Match="NavLinkMatch.Prefix">Abonnenter</MudNavLink>
<MudNavLink Href="servicesconfig" Match="NavLinkMatch.Prefix">Tilbyder</MudNavLink>
<MudNavLink Href="subscribers" Match="NavLinkMatch.Prefix">Abonnenter</MudNavLink>
</MudNavGroup>
<MudNavGroup Title="Datasett" Expanded="true">
<MudNavLink Href="/dataset" Match="NavLinkMatch.Prefix">Datasett</MudNavLink>
<MudNavLink Href="/datasetsubscribers" Match="NavLinkMatch.Prefix">Datasett abonnenter</MudNavLink>
<MudNavLink Href="dataset" Match="NavLinkMatch.Prefix">Datasett</MudNavLink>
<MudNavLink Href="datasetsubscribers" Match="NavLinkMatch.Prefix">Datasett abonnenter</MudNavLink>
</MudNavGroup>
<MudNavLink Href="/storedchangelogs" Match="NavLinkMatch.Prefix">Endringslogg</MudNavLink>
<MudNavLink Href="storedchangelogs" Match="NavLinkMatch.Prefix">Endringslogg</MudNavLink>
<MudDivider />
<MudNavLink Href="/about" Match="NavLinkMatch.Prefix">Om</MudNavLink>
<MudNavLink Href="about" Match="NavLinkMatch.Prefix">Om</MudNavLink>
@* <MudSpacer />
<MudStack Justify="Justify.FlexEnd" AlignItems="AlignItems.End" Row="false">
<MudNavLink Href="/about" Match="NavLinkMatch.Prefix">Om</MudNavLink>
Expand Down
22 changes: 20 additions & 2 deletions Kartverket.Geosynkronisering.Server/ChangelogManager/JsonConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.Extensions.Configuration;
//using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Serilog;

namespace ChangelogManager
{
Expand All @@ -16,14 +17,31 @@ public class JsonConfig

public static IConfiguration SetupJsonConfig(object bindTo = null)
{
Log.Information("start SetupJsonConfig");

//var testGetCurrentDirectory = System.IO.Directory.GetCurrentDirectory();
//Log.Information("SetupJsonConfig testGetCurrentDirectory: {0}", testGetCurrentDirectory);


// issue #157: fix for self-contained executable, Assembly.GetEntryAssembly().Location failes
var strPath = Process.GetCurrentProcess().MainModule.FileName;
Log.Information("SetupJsonConfig strPath: {0}", strPath);
//var strPath = Assembly.GetEntryAssembly().Location; //AppDomain.CurrentDomain.BaseDirectory;

var basePath = Path.GetDirectoryName(strPath);

Log.Information("SetupJsonConfig basePath: {0}", strPath);
var strJsonFile = Path.Combine(basePath, "appsettings.json");
Log.Information("SetupJsonConfig strJsonFile: {0}", strPath);

if (!File.Exists(strJsonFile))
{
// When blazor-app is published on IIS, we must use this method to find the correct directory of where the project is stored
basePath = AppDomain.CurrentDomain.BaseDirectory;
Log.Information("SetupJsonConfig basePath: {0}", basePath);
strJsonFile = Path.Combine(basePath, "appsettings.json");
Log.Information("SetupJsonConfig strJsonFile: {0}", strJsonFile);

}
var configuration = new ConfigurationBuilder()
.SetBasePath(basePath) // Directory where the json files are located
.AddJsonFile(strJsonFile, optional: false, reloadOnChange: true)
Expand All @@ -38,8 +56,8 @@ public static IConfiguration SetupJsonConfig(object bindTo = null)

// test
//var connectionstring = configuration.GetValue<string>("connectionStrings:geosyncEntities");


Log.Information("SetupJsonConfig End ,configuration != null: {0}", configuration != null);
return configuration;
}
}
Expand Down

0 comments on commit 16603d5

Please sign in to comment.