Add Cors handling to Blazor UI
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
|
||||
|
||||
|
||||
**************** PUBLISHING
|
||||
pi@Dia:~/ARM64/eNavigator $ dotnet publish -c Release
|
||||
dotnet publish -c Release
|
||||
I might not understand this all correctly but I got it to work.
|
||||
when you dotnet publish -c Release
|
||||
@@ -7,18 +10,19 @@ There will be output here..
|
||||
/home/pi/Projects/Blazor/eNavigator/eNavigatorUI/bin/Release/net8.0
|
||||
There is a publish folder as well as a wwroot folder
|
||||
open the publish folder and then the wwroot folder within
|
||||
copy the contents of this folder to /var/www/html on the apache server
|
||||
copy the contents of this (wwroot) folder to /var/www/html on the apache server
|
||||
sudo cp -r --verbose /home/pi/Media/Boneyard/publish/wwwroot/* .
|
||||
sudo cp --verbose -r /home/pi/Media/Boneyard/wwwroot/_framework .
|
||||
|
||||
now look at the wwwroot folder and notice that there is also a _framework folder here as well
|
||||
copy this _framework folder to /var/www/html (yes overwriting the previous _framework that you coped)
|
||||
copy this _framework folder to /var/www/html (yes overwriting the previous _framework that you copied)
|
||||
|
||||
restart the apache web server
|
||||
service apache2 restart
|
||||
sudo service apache2 restart
|
||||
goto web site http://www.diversified-software.com
|
||||
all should be working.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**************************
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace eNavigator.Interfaces
|
||||
public interface IMarketDataServiceClient
|
||||
{
|
||||
public Task<bool> Ping();
|
||||
public Task<ServiceResult> GetSystemInfo();
|
||||
public Task<ServiceResult> Login(String user, String password);
|
||||
public Task<bool> IsAuthorized();
|
||||
public Task<ServiceResult> GetDistinctConsumerPriceIndices();
|
||||
|
||||
@@ -61,6 +61,25 @@ namespace eNavigator.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ServiceResult> GetSystemInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("/api/Ping/GetSystemInfo");
|
||||
String json = await httpClient.GetStringAsync(sb.ToString());
|
||||
json=ToConformimgJson(json);
|
||||
String accessToken = JsonConvert.DeserializeObject<String>(json);
|
||||
return new ServiceResult(accessToken);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exceptions.Add(exception);
|
||||
Console.WriteLine(exception.ToString());
|
||||
return new ServiceResult(false,exception.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ServiceResult> Login(String user, String password)
|
||||
{
|
||||
try
|
||||
@@ -73,6 +92,7 @@ namespace eNavigator.Service
|
||||
sb.Append("&password=").Append(password);
|
||||
Console.WriteLine(httpClient.BaseAddress+sb.ToString());
|
||||
String json = await httpClient.GetStringAsync(sb.ToString());
|
||||
json=ToConformimgJson(json);
|
||||
AccessToken = JsonConvert.DeserializeObject<String>(json);
|
||||
if(default == AccessToken)return new ServiceResult(false);
|
||||
return new ServiceResult(AccessToken){ElapsedTimeMS=profiler.End()};
|
||||
@@ -502,5 +522,13 @@ namespace eNavigator.Service
|
||||
return new ServiceResult(false,exception.ToString());
|
||||
}
|
||||
}
|
||||
private static String ToConformimgJson(String json)
|
||||
{
|
||||
if(String.IsNullOrEmpty(json))return json;
|
||||
if(json.StartsWith("\"") && json.EndsWith("\""))return json;
|
||||
if(json.StartsWith("[") && json.EndsWith("]"))return json;
|
||||
if(json.StartsWith("{") && json.EndsWith("}"))return json;
|
||||
return Utility.AddQuotes(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
eNavigator/eNavigatorUI/eNavigatorUI.sln
Normal file
24
eNavigator/eNavigatorUI/eNavigatorUI.sln
Normal file
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eNavigator", "eNavigator.csproj", "{761D4A8A-CC84-EDB8-3B37-A4566C635D5D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {20BF51CE-862A-47B3-981B-AA43CAC69A1B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user