Hello team, it's me again. My Blazor Server project works ok when debugging on VS. But as soon as I release it into IIS, the map only loads the core layer, and not the GeoJSON i am loading as auxiliary data. This is the code i'm using for it:
protected override async Task OnInitializedAsync()
{
editContext = new EditContext(search);
if(WithDocapescaPolygons)
{
try
{
isLoading = true;
var response = await mappingService.GetMapGeoJSON();
if(response.Status == ReturnStatus.Success)
{
geoJSON = response.Result!;
needsPostRender = true;
}
else
{
toastService.ShowError(response.Error!);
}
}
catch(Exception e)
{
toastService.ShowError(e.Message);
}
finally
{
isLoading = false;
StateHasChanged();
}
}
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if(needsPostRender && _map is not null)
{
needsPostRender = false;
try
{
await LoadGeoJSON();
}
catch(Exception e)
{
toastService.ShowError(e.Message);
}
finally
{
StateHasChanged();
}
}
await base.OnAfterRenderAsync(firstRender);
}
private async Task LoadGeoJSON()
{
var layer = _map.LayersList.FirstOrDefault(l => l.Id.Equals(layerId));
if(layer is not null)
await _map.RemoveLayer(layer);
if(geoJSON is not null)
{
await _map.AddLayer(layer = new Layer()
{
Id = layerId,
LayerType = LayerType.Vector,
SourceType = SourceType.VectorGeoJson,
Projection = geoJSON.Authority,
Data = geoJSON.Content,
StyleCallback = GetShapeStyle,
RaiseShapeEvents = true
});
await _map.SetZoomToExtent(layer);
}
}
LoadGeoJSON() method runs without any exception, the properties geoJSON.Authority and geoJSON.Content (exported from GDAL/OGR) are ok, just as when I debug on VS, but after calling await _map.AddLayer there's no new layer added (just when I release with IIS). The console doesn't show any error, so I'm lost at that point. Any ideas about what could be the problem?
Thanks in advanced. Best regards.
Hello team, it's me again. My Blazor Server project works ok when debugging on VS. But as soon as I release it into IIS, the map only loads the core layer, and not the GeoJSON i am loading as auxiliary data. This is the code i'm using for it:
LoadGeoJSON()method runs without any exception, the propertiesgeoJSON.AuthorityandgeoJSON.Content(exported from GDAL/OGR) are ok, just as when I debug on VS, but after callingawait _map.AddLayerthere's no new layer added (just when I release with IIS). The console doesn't show any error, so I'm lost at that point. Any ideas about what could be the problem?Thanks in advanced. Best regards.