PDA

View Full Version : Missing the application name



oscarq1
Oct 21, 2020, 7:43 AM
I created an example form Ext.Net.Template (Ext.Net.Classic 7.0)
In 'launchSettings.json' file, I set

{ "applicationUrl": "http://localhost:5000"}
start the web, it works well.
But I set it with an appPath "/extnet7"

{ "applicationUrl": "http://localhost:5000/extnet7"}
it not work, because it also generated the resource files(urls) as

<link type="text/css" rel="stylesheet" href="/extnet/extjs/packages/theme-spotless/build/resources/theme-spotless-all.css"/>
<script type="text/javascript" src="/extnet/extjs/ext-all.js"></script>
<script type="text/javascript" src="/extnet/extnet/extnet-all.js"></script>
Actually, they should be like these

<link type="text/css" rel="stylesheet" href="/extnet7/extnet/extjs/packages/theme-spotless/build/resources/theme-spotless-all.css"/>
<script type="text/javascript" src="/extnet7/extnet/extjs/ext-all.js"></script>
<script type="text/javascript" src="/extnet7/extnet/extnet/extnet-all.js"></script>

Also I deployed it on IIS, "Default Web Site" -> New application "extnet7"
I visit http://localhost/extnet7/
I got the same error.

25454

25455

geoffrey.mcgill
Oct 21, 2020, 1:25 PM
Hi. Thanks for the report. We are investigating.

geoffrey.mcgill
Oct 21, 2020, 3:15 PM
Yep, there's an issue here.

A fix might not be as straightforward as we initially thought.

We are still working our way through some potential solutions and will post another update once we have a fix or workaround available.

oscarq1
Oct 21, 2020, 4:47 PM
Thank you so much.

geoffrey.mcgill
Oct 21, 2020, 7:21 PM
There is a defect in Ext.NET, but there is also an easy workaround that can be used until the fix becomes available.

Please make the following revision within your projects Startup.cs file, inside in the Configure method.

If you created a new app from the Ext.NET.Templates, you should see the following UseExtNetResources configuration block:



app.UseExtNetResources(config =>
{
if (env.IsDevelopment())
{
config.UseDebug(true);
}

config.UseEmbedded();
config.UseCharts();
config.UseThemeSpotless();
});


Please change to the following:



app.UseExtNetResources(config =>
{
config.UseEmbedded();
config.UseCharts();
config.UseThemeSpotless();
});

// Re-map the Ext.NET resources to a custom root path,
// and configure Debug/Rtl parameters
app.UseExtNetResources("/extnet7/extnet", config =>
{
if (env.IsDevelopment())
{
config.UseDebug(true);
}
});


This re-mapping of the resources should work for now.

Once the fix is available in a future release, all you will require is to pass the path base. For example, the UseExtNetResources config would be:



app.UseExtNetResources("/extnet7/extnet", config =>
{
if (env.IsDevelopment())
{
config.UseDebug(true);
}
config.UseEmbedded();
config.UseCharts();
config.UseThemeSpotless();
});


There is another workaround option where changing the Configure method signature to one where a runtime context is passed. For instance:



public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Ext.Net.Core.Execution.IExtRuntimeCtx extRuntime)
{
app.UseExtNetResources(config =>
{
config.UseEmbedded();
config.UseThemeSpotless();
config.UseCharts();
});

extRuntime.RequestRoot = "/extnet7/extnet";
}


If you are using Kestrel, you'll need to add a call to app.UsePathBase("/extnet7"); at the top of the Configure method.



public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UsePathBase("/extnet7");

// all other existing configs below
}


Thanks for reporting the issue. It was an interesting one.

Hope this helps.

oscarq1
Oct 22, 2020, 1:44 AM
Hi, @geoffrey.mcgill, thank you for your help!
I tested your code:

1. app.UseExtNetResources("/extnet7/extnet", config =>
{
...
})
it not work, the resource's path is mapped to the /extnet7/extnet7/extnet
for example:

http://localhost/extnet7/extnet/extjs/ext-all.js 404
http://localhost/extnet7/extnet7/extnet/extjs/ext-all.js ok


2. app.UsePathBase("/extnet7");
it not work, the resource's path is mapped to the '/extnet7/extnet7/extnet7/extnet'
for example:

http://localhost/extnet7/extnet/extjs/ext-all.js 404
http://localhost/extnet7/extnet7/extnet7/extnet/extjs/ext-all.js ok


3. extRuntime.RequestRoot = "/extnet7/extnet";
it works fine!

http://localhost/extnet7/extnet/extjs/ext-all.js ok

Thanks & Best regards

geoffrey.mcgill
Oct 22, 2020, 12:13 PM
We have fixed the issue and we can provide a patch release for testing if you email support@ext.net with the request.

With the next release, no workaround is required and the original configuration will automatically detect the base path. If you have one of the workarounds above, it will have to be removed to use the next release (7.2.0).

As of the next release (7.2.0), the original configuration will work as expected for the original scenario reported in this thread:


app.UseExtNetResources(config =>{
if (env.IsDevelopment())
{
config.UseDebug(true);
}

config.UseEmbedded();
config.UseCharts();
config.UseThemeSpotless();
});

oscarq1
Oct 22, 2020, 2:16 PM
Good job! I'm looking forward to the next release.
Thanks!