Base solution for your next web application

Activities of "jcompagnon"

Hi Ismail,

Perfect, that sounds like what I was looking for ; I'll take a look at those application parts, and run with it for now.

Thank you once again for the feedback & the resources!

Ahh ok! It's working now, then, with the views and all? That's great!

No problem, glad to have been of some help! Best of luck with the project!

No problem at all; I've found more than my share of info from other users on the forum, so I'm glad I can start helping out!

The directory browser is a tool that can be enabled in the Startup.Configure method of your .Net Core web app (MS docs)

public void Configure(IApplicationBuilder app)
{
    app.UseStaticFiles(); 
   app.UseEmbeddedFiles();
    app.UseDirectoryBrowser(new DirectoryBrowserOptions
    {
        FileProvider = EmbeddedFileProvider(typeof(ControllerInYourOtherModule).GetTypeInfo().Assembly,"OtherModule.Web"),
        RequestPath = "/TestDirectory"
    });
}

After enabling it & firing it up, you can navigate to the URL set in the RequestPath, and you'll get a listing of the embedded resources coming from the specified assembly. Just a heads-up, though: I only did this when trying to figure out how to load the views - so I didn't bother with any security, since I removed the tool before deploying. Make sure to remove it, or add security, before you deploy it anywhere with the Directory Browser on.

Alright, that's really strange. Did you have any luck loading/navigating through the directory browser? It allows you to see what embedded resources are loaded, as well as giving an indication of their routes.

Hmm, that's strange.

The problem I was facing at the time was related to hosting the app under a virtual directory (something that was fixed in an update last year). Aside from that, from what I recall, marking the views/scripts as embedded, creating an EmbeddedResourceSet & adding the appropriate [DependsOn()] attribute to the parent Module's definition was all that was required.

Also, at the time, I was not using the .Net Core version; once I did, I needed to add a line to the Startup.cs class, throwing in:

//... existing code under Configure()
            app.UseStaticFiles();//already there
            app.UseEmbeddedFiles();//magic!

I also added the following lines directly underneath to be able to inspect what files were correctly embedded, which helped visualize any routing issue I'd had:

//app.UseDirectoryBrowser(new DirectoryBrowserOptions
            //{
            //        FileProvider = new EmbeddedFileProvider(typeof(ControllerInYourOtherModule).GetTypeInfo().Assembly,"OtherModule.Web"),
            //        RequestPath = "/TestDirectory"
            //});

Hello @csbeginner,

Have you marked the .cshtml files as embedded resources in your assembly?

Thanks @alper!

I've been suspecting for a while that both the device and computer need to be on the same WiFi network, but it isn't explicitly stated anywhere in the documentation.

Otherwise, I think I've been doing everything else properly.

Stupid question, but I'm assuming in DebugServerIpAdresses.cs,

public static string Current => LocalhostIp;

//You can configure your computer's IP adress for external access (if Current = LocalhostIp)
private const string LocalhostIp

should be set to the IPv4 of the computer I'm working on, correct?

@ismcagdas,

I downloaded the Start-Host.zip file included in that documentation and changed the destination for the .Web.Host to where the files are stored locally on my computer C:\Users[username]\Documents\CoreTest\CoreTest\src\CoreTest.Web.Host.

Therefore I run .bat file to start the host

No, my computer is hooked up via Ethernet and my phone is on LTE.

At first, I was under the impression that hooking up the smartphone via USB would connect it to the same network as the computer, especially since the emulator is running on LTE but is able to connect just fine. Based on your question and my recent tests though, that doesn't seem to be the case.

I've tried looking up the public IP of my network and putting that as the LocalhostIp, but that doesn't work either. Perhaps the easiest way around this would be to hook up my phone and computer to the same WiFi, but my office has a WiFi network that I cannot access. Otherwise I was looking into reverse usb tethering, but that seems to be quite a bit of work to accomplish.

Is this scenario something that should work or am I hitting my head against a wall for nothing?

Showing 1 to 10 of 31 entries