Comments (4)
Ok... well.. I feel like an idiot. I was working in some new code, not realizing the StartUp.cs was not being used to set up the OWIN environment. Very similar code was being wired up elsewhere in the application, so the OWIN behavior looked very similar. Once I wired up the Startup.cs I built, AutoFac started to work as designed. Sorry for the false alarm.
B
from autofac.webapi.
While I don't see anything obvious, I'm on my mobile at the moment and am not doing heavy research. Since I mostly dev on Mac nowadays, it will take a while to be able to set something up to troubleshoot.
This is sort of why the "new issue" page directs "how do I?" questions to Stack Overflow - there are folks doing this stuff all the time that can quickly answer the questions, and the Autofac team monitors there. For issues, only the Autofac team (of, like, three total people) watch, and it means answers may be slow.
I might recommend:
- See if you can get any type of Autofac filter to work - not just authorization. If you can't get any filter to work, you might be setting something up wrong. For example, sometimes folks think they're using OWIN but are still referencing the global dependency resolver. (Not saying you're doing that, just giving an example.)
- Look at examples in our Examples repo. Any examples there showing filter usage?
- Look at the unit tests in this repo. Anything show what you're doing?
- Are you actually using it as an attribute? Web API makes attributes singletons. I think we touch on that in the docs. What happens if you implement the Autofac interface but don't derive from the attribute?
Anyway, these are the steps I'd have to go through to figure it out. Sadly, I just can't keep every detail of every integration in my head anymore so I don't have these answers at my fingertips. Again, that's why we rely on Stack Overflow - to get more eyes from the community on questions, so we can focus on reproducible issues in the repos.
If you figure it out, post back here so we can close the issue. If you don't... It may take a bit before I can personally come in and figure this out.
from autofac.webapi.
I've taken a quick peek at the code; nothing obvious jumps out at me either. I'd consider:
-
Enabling Autofac Diagnostics, and seeing if Autofac ever resolves an
IEnumerable<Meta<Lazy<IAutofacAuthorizationFilter>>>
. If it does, then you know that we're actually looking for those filters, and you can hopefully see subsequently in the diagnostics that one item gets loaded from that set. -
If that doesn't yield anything, consider putting together a minimal recreating project of an Authorization filter not working, outside of any of your other project behaviour. As @tillig said, this sort of stuff, particularly in the OWIN world, can be easily caused by something wrong somewhere else.
from autofac.webapi.
Thanks @tillig and @alistairjevans . Let me work on your suggestions, and I will report back my findings The first thing I'm going to try is setting up a simple action filter and see if I can get that to work. I'll keep this thread posted. Thanks!
from autofac.webapi.
Related Issues (20)
- Dependency Issue on latest version on nuget HOT 2
- Bad async/await implementation causing loss of execution context. HOT 9
- Help - Autofac.WebApi2 Global Action FIlters Parameters injection failed HOT 1
- Please, consider to release the 4.2.0 version of the Nuget package HOT 2
- Could not load file or assembly 'Autofac, Version=3.0.0.0' when using Autofac.WebApi 3.1.0 HOT 3
- What should I do tp set the value of ControllerContext property after GetService method? HOT 3
- Cannot get Autofac to work with Web API HOT 2
- Performance: Use TryGetValue instead of ContainsKey() + indexer sequence HOT 3
- Registration of filters on base classes no longer work HOT 3
- Test Failures on Autofac 4.0.1 or Later HOT 8
- Autofac filters for specific 'async' action in a controller not working HOT 1
- Injecting a registered named service is not working as expected. HOT 1
- Autofac 5 was pushed to Github a few days ago along with MVC 5 but the current version of WebApi2 is not usable with it HOT 1
- Compatibility with Autofac v6 HOT 1
- Web requests never return when using Autofac, unless pre-resolved HOT 2
- HttpRequestMessage is disposed after the filters are resolved HOT 7
- Override Exception Filters executed last instead of first HOT 3
- Filters at controller scope not ran when action scoped filters exist. HOT 3
- Change CallContext to AsyncLocal HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autofac.webapi.