Aug 17, 2019 22:44
Cool, thanks. Take care.
Aug 17, 2019 22:42
Early days. You're in the right place, asking questions and learning about how things work. That's a great start.
Aug 17, 2019 22:38
Haha, sorry, I wondered if you meant SO. I've been coding professionally for 13 years now. Started learning to code before that, so all in all it's close to 20 years. How about you?
Aug 17, 2019 22:37
Doing what, exactly?
Aug 17, 2019 22:31
Sure. It's no problem. I could post it as a real answer, which you can accept if you wish to.
Aug 17, 2019 22:30
Yeah, that's it. Using await means it unwraps the result for you. You were just passing a Task into that Json call, but now you're passing the list you wanted instead. :)
Aug 17, 2019 22:29
So you'll see that those properties like Result, IsFaulted, etc, all come from Task.
Aug 17, 2019 22:28
The problem is that without await, it's returning the Task instead of the result of the Task.
Aug 17, 2019 22:24
Did the code snippet I sent work for you?
Aug 17, 2019 22:23
Yeah, I'm here.
Aug 17, 2019 22:20
public async Task<ActionResult> GetActors() { return Json(await _Ilogic.GetAllActorsAsync(), JsonRequestBehavior.AllowGet); }
Aug 17, 2019 22:20
Ok, now the problem is obvious. You need to await _Ilogic.GetAllActorsAsync() in GetActors and make GetActors itself async.
Aug 17, 2019 22:20
It looks like your API is serialising a Task<T> instead of just T. Missing an await somewhere in the API?
 
May 16, 2019 16:59
When you check "Remember me", the information is stored in a cookie that lasts for two weeks and is not session-based, meaning it works in all instances of the browser also in IE and even if you close the browser.
May 16, 2019 16:58
That might all be a bit confusing but the main thing to learn about is the concept of a session-based cookie. It seems IE doesn't play as nicely as the other browsers.
May 16, 2019 16:58
Yes, kind of. When you don't check the box, the user is saved into a session cookie, which is usually lost when the browser is closed. In every other browser, the session is still alive even if you open a new tab or instance of the browser, but with IE, the session doesn't live on in another instance of the browser and so the fact that you are logged in to Identity Server is lost.
May 16, 2019 16:52
It's worth noting that IE is a browser that 1) has lots of bugs and 2) has been replaced by Edge. There are a lot off issues that exist only IE and cannot be avoided.
May 16, 2019 16:46
When you go to your Identity Server login page and enter your user name and password, is there a checkbox on the page for "Remember me?".
May 16, 2019 16:45
Yeah, I understand that. Are you using ASP.NET Core Identity in your Identity Server project?
May 16, 2019 16:43
I don't know what you're using. The code you've shown isn't for Identity Server, which is where the SSO user would be persisted.
May 16, 2019 16:43
My guess is that the auth is being stored in a session, which doesn't track across multiple instances of IE.
May 16, 2019 16:43
Do you have a "remember me" option in your Identity Server setup? If so, check it and see if that changes things.
May 16, 2019 16:43
If MVCApp1 redirects you to Identity Server to login and then MVCApp2 redirects you to Identity Server to login, I'd expect you to be already logged in to Identity Server on that MVCApp2 redirect and so I wouldn't expect you to be prompted for credentials again. Not every setup is the same, so that's not black and white, but it is the general idea of SSO as I understand it.
May 16, 2019 16:43
The idea is that you sign in to Identity Server, which remembers you (either session-based or persistent). You log in with MVCApp1, which gets you to log in to Identity Server. When you proceed to log in with MVCApp2, Identity Server already has you authenticated and so just issues a new token for MVCApp2. Both MVCApp1 and MVCApp2 have a different authentication token, but you've only had to log in to Identity Server once.
 
Apr 2, 2019 13:29
I will try and write up an answer later if you haven't resolved it before then.
Apr 2, 2019 13:29
I think you'll need to inject the root IServiceProvider into your MqttBroker and then create an explicit scope within that whenever you want an instance of a scoped service.
Apr 2, 2019 11:52
The reason you get an ObjectDisposedException is because the IServiceProvider that's injected into your Configure method is scoped and gets cleaned up once Configure itself completes. When the scope is cleaned up, all scoped services that were created are also cleaned up (i.e. disposed).
Apr 2, 2019 11:43
Yes, I think I know what the problem is. I'll try and write up an answer later.
Apr 2, 2019 10:58
Have you managed to resolve this?
 
Mar 20, 2019 09:04
In that example, both SlugRepository and CategoriesRepository would usually be registered with DI and passed into CityController itself.
Mar 20, 2019 08:19
I'm confused that your question talks about OnCreatingTicket but here you're talking about a controller.
Mar 20, 2019 08:07
@OffirPe'er Have you been able to test the accepted answer? I wouldn't expect it to work if I'm understanding things correctly.
 
Feb 19, 2019 22:19
Ultimately, you want to build an ASP.NET Core 2.x application (the right drop-down), but that can target either .NET Core or .NET Framework (the left drop-down). As @mason notes, you're all set with what you have selected.
 
Jan 11, 2019 08:58
Good to hear. You're welcome.
Jan 10, 2019 22:29
@Falcon Did you get any further with this?
Jan 9, 2019 22:00
I have to leave now (it's getting late here), but I can pick this up again tomorrow.
Jan 9, 2019 22:00
If you want to put together a dummy project in GitHub that shows how you've got the front-end/back-end projects set up, I could make a pull-request that would show you what I mean.
Jan 9, 2019 21:59
It's hard to explain fully here in text, but imagine the Startup class in your front-end project calls a method in your back-end project, which itself makes your call to set up the IOptions<> it needs.
Jan 9, 2019 21:58
Which means you can have your API controllers inside of the API DLL, but specifically for your situation, it seems you might want to have a method inside of your API DLL that you can call from your front-end project to do the Configure<> stuff.
Jan 9, 2019 21:57
So what is currently your front-end project isn't really just front-end - it sets up the front-end URLS as MVC (or whatever it is you're using) and it also sets up URLs for the API that live under /api/....
Jan 9, 2019 21:56
So in your case it seems you have one ASP.NET Core hosting project that is your front-end, but pulls in some API controllers, etc, from the back-end API. In that case, there's still only one hosting project and that would therefore need a single Startup and a single set of configuration files, etc.
Jan 9, 2019 21:55
They don't have to be hosted separately, for example, you might have the back-end project live under /api/..., which is fine too.
Jan 9, 2019 21:54
If you have a front-end project and a back-end project, they would usually be hosted separately, perhaps using different ports or different subdomains.
Jan 9, 2019 21:52
Ideally, you'd want to have the Startup and the configuration files all as part of the hosting project.
Jan 9, 2019 21:52
That's right. I think if you have more than one call to UseStartup, it will just use the last one added.
Jan 9, 2019 21:49
It's no problem.
Jan 9, 2019 21:49
It sounds like you may have found the reason for your issue then.
Jan 9, 2019 21:49
The Startup class will only get executed if it's referenced by a call to UseStartup<> in your Program.cs file - if your hosting project isn't referring directly to the Startup class that has your Configure call, it will not work. If you run the project you've put in GitHub standalone, does it work for you?
Jan 9, 2019 21:49
I've just managed to run your example project and it works for me - I can see all the values populated in the controller when I use the first approach and just the ConnectionString property is populated when I use the second approach (as expected).
Jan 9, 2019 21:49
That all works for me with 2.0. I think this may be an issue with not being able to find your appsettings.json file. Are you able to upload the project to e.g. GitHub so I can run it to see what's going wrong?