Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dotnet/src/dotnetcore/GxClasses.Web/Middleware/GXRouting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,13 @@ public void ServicesGroupSetting()
throw;
}
}

public void ServicesFunctionsMetadata()
{
//Used for Azure functions

string functionMetadataFile = "functions.metadata";
string metadataFilePath = Path.Combine(ContentRootPath, functionMetadataFile);

if (File.Exists(metadataFilePath))
{
AzureRuntime = true;
Expand Down
8 changes: 7 additions & 1 deletion dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2923,6 +2923,8 @@ public static bool IsRestService
}
#if NETCORE
static bool _isHttpContext;
internal static bool IsAzureContext
{ get; set; }
#endif
public static bool IsHttpContext
{
Expand Down Expand Up @@ -3581,7 +3583,7 @@ Hashtable Images
string imgDir = "";
if (String.IsNullOrEmpty(dir) && _HttpContext == null)
{

GXLogging.Debug(log, "Searching for txt files ..");
int srchIx = 0;
string[] paths = new string[] { ".\\", "..\\" };
bool found = false;
Expand All @@ -3597,9 +3599,13 @@ Hashtable Images
}
}
imgDir = dir;
GXLogging.Debug(log, $"{imgDir} txt file found");
}
else
{
imageFiles = Directory.GetFiles(dir, "*.txt");
GXLogging.Debug(log, "imageFiles found");
}

string KBPrefix = String.Empty;
char[] densitySeparator = new char[] { '|' };
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.Extensions.Primitives;
using System.Net.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
using System.Reflection;
#else
using System.ServiceModel.Web;
using System.ServiceModel;
Expand Down Expand Up @@ -270,6 +271,9 @@ public static bool GetHttpRequestPostedFile(IGxContext gxContext, string varName
public static string RequestPhysicalApplicationPath(HttpContext context = null)
{
#if NETCORE
if (GxContext.IsAzureContext)
return FileUtil.GetStartupDirectory();

return Directory.GetParent(FileUtil.GetStartupDirectory()).FullName;
#else
if (context==null)
Expand Down
12 changes: 6 additions & 6 deletions dotnet/src/extensions/Azure/Handlers/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Reflection;
using System.Text.Json;
using System.Threading.Tasks;
using GeneXus.Application;
using GeneXus.Cache;
using GeneXus.Deploy.AzureFunctions.Handlers.Helpers;
using GeneXus.Services;
Expand All @@ -19,8 +20,8 @@ static async Task Main()
{

string roothPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string routePrefix = GetRoutePrefix();
GXRouting.ContentRootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string routePrefix = GetRoutePrefix(roothPath);
GXRouting.ContentRootPath = roothPath;

var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
Expand All @@ -43,13 +44,12 @@ static async Task Main()
services.AddSingleton<ICacheService2>(x => new InProcessCache());
})
.Build();

await host.RunAsync();
GxContext.IsAzureContext = true;
await host.RunAsync();
}
private static string GetRoutePrefix()
private static string GetRoutePrefix(string ContentRootPath)
{
//Read host.json file to get Route prefix
string ContentRootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string hostFile = "host.json";
string hostFilePath = Path.Combine(ContentRootPath, hostFile);

Expand Down