New to .NET Core

I download last version today of RemObject Elements.
I simply created a new project as ASP.NET core, but then I could not run it.
I am new to .NET core.
Please I need some tutorial on how to start

What problem or error did you get?

Maybe youā€™re confused by the fact that, at least with Fire on a Mac, if you run the project, the browser isnā€™t opened by default.

When you run the project, look at the build log. Youā€™ll see a log entry like ā€œNow listening on: https://localhost:5001ā€.

Go to you browser en then enter the mentioned url. That should do it. Unless you have an other problem.

Same thing for Visual Studio 2019ā€¦

Is that something that should happen? The way I see it, youā€™re just running an executable (that happens to be a web server), but the IDE/debugger does not know anything about what that executable does, or that you would want to interact with it from a browser. What would happen on repeated runs? Would each run start a new browser? would the browser be killed after the run is over? What if you wanna look at the site from you existing already running Safari stance? etc etcā€¦

I have many years experience with VS on Windows, where it was ā€œnormalā€ that VS would bring the browser to the front with the page.

In Fire I too was confused that this didnā€™t happen and also thought that something was wrong. But now I think this is a better approach, as VS would open a new browser tab for every new run. Actually, which is a better description, VS just ā€œopened the urlā€ and the OS decides which browser to open and/or using a new tab. This could result in many opened tabs if you donā€™t close the present tabs coming from older runs.

Now I just have one tab open pointing to the localhost url. After a new build run, I just refresh the tab. Much cleaner and am already used to that now.

1 Like

Thatā€™s how I would expect most people would want to handle this, yeah. I donā€™t use ASP.NET ā€œlike thatā€ myself (I use the loose Web Site mode where you just have files and IIS build whats needed as you request em, so I just make changes in Fire, switch to Safari and hit Refresh, w/o even building).

I cant see how a new browser window/tab, loaded to /, would be helpful for any kind of workflow, except for the very first run of a work sessionā€¦

But Iā€™ll think about what I can do in Fire/Water to make this more intuitive. maybe ask on first run of the project in the current IDE session whether to launch the browser?

For ASP.NET Core, there is a setting in the launchsettings.json file that indicates whether the browser must be started or not.

More info: https://dotnettutorials.net/lesson/asp-net-core-launchsettings-json-file/

Ugh. ok. Iā€™ll have a more detailed look at whether to support that that way or not.

As the setting already exists in this file (and there are other settings here), it would be nice to use the same one. It will also be consistent with the ASP.NET Core documentation.

I guess. Iā€™ll probably change the template default to false, then, and add the option to sdk the first time.

Thanks, logged as bugs://84785 for Fire/Water

1 Like

Thanks, logged as bugs://84786 for VS

Note that we still donā€™t know if this as the OPā€™s issue, of courseā€¦

Hi
Actually there is no error message.
Well let me explain, knowing that this is my first .NET core web application and I have no idea about .NET core.

I simply created new web application using .NET (I used Element oxygen-Pascal)
Then I just click the runā€¦ then VS compiled with no errors, then a DOS windows open and closed quickly, then I get an error in the VS error output telling that there is missing assemblies.

Then I build the project, and it build successfully with no error.

I believe it is my problem not knowing how to work with .NET core to create a web application.
If I can have a step by step tutorial learning me how to create a web application using .NET core

Curious. Can you try running the .exe yourself from a command prompt (so it wonā€™t close) or from Water, so you can get the actual error message thats shown?

Can I see that message and/pr ideally a screenshot of where it shows in VS?

the project form, the template should work out of the box, so something must be wrong here.

thanx,
marc

1 Like

Silly question, but that does launchUrl do? And I assume the browser should just open the first url from applicationUrl, if there are multiple? How does the actual code know to run on 5000/5001, is that just hardcoded and we assume the launch setting to match? I donā€™t find it defined anywhere else, and the app wont have access to laumchSettings.json at runtime, so it canā€™t be getting it from thatā€¦

      "launchBrowser": true,
      "launchUrl": "weatherforecast",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",

Iā€™ve made some tests with a Microsoft C# project and I find the following:

1. launchUrl can be relative or absolute.
2. If launchUtl is relative, the URL is the concatenation of applicationUrl and launchUrl (with a ā€˜/ā€™ in between). If launchUrl is absolute., the URL is launchUrl.
3. Under iisSettings:iisExpress, there is an applicationUrl entry to use for debuggingā€¦ when using IIS Express as the web server.
4. Under profiles there are two profiles by default: IIS Express, to use for debugging and WebApplication1 (or the name of the solution), to use for production. I donā€™t know how VS selects the profile to run (there can be more than 2).

Do you have the full file content (it depends on where it is located) ?

For debugging (iiSettings:iisExpress section), there can be only one URL. For command.line start, it indicates the URLs to which the application must respond.