Comments (16)
Added check "&& !behaviors.Contains(behavior)" into WcfUtils and it works
internal static void AddBehaviors<T>(IKernel kernel, WcfExtensionScope scope,
ICollection<T> behaviors, IWcfBurden burden,
Predicate<T> predicate)
{
foreach (var handler in FindExtensions<T>(kernel, scope))
{
var behavior = (T)handler.Resolve(CreationContext.CreateEmpty());
if (predicate == null || predicate(behavior))
{
if (behaviors != null && !behaviors.Contains(behavior)) behaviors.Add(behavior);
if (burden != null) burden.Add(behavior);
}
}
}
from windsor.
nice.
Do you want to pull request that change? Just make sure you have the tests to validate it's working
from windsor.
With the test it will be problem. It seems to me that something wrong as I have 133 tests failing before I did the change. I'm a bit behind of master. I'm on fd20561. I'll try to update
from windsor.
you might need to make sure you’re running as admin or that port sharing is enabled…
We should probably change the tests to give people nicer error message in that scenario… might be another pull request ;)
Krzysztof Kozmic
On Thursday, 13 February 2014 at 1:58 pm, Alex2357 wrote:
With the test it will be problem. It seems to me that something wrong as I have 133 tests failing before I did the change. I'm a bit behind of master. I'm on fd20561 (fd20561). I'll try to update
—
Reply to this email directly or view it on GitHub (#44 (comment)).
from windsor.
you might need to make sure you’re running as admin or that port sharing is enabled
Is it "or" or "and", i.e. I should run as admin AND port sharing enabled, because when I run only under admin I have 16 failed tests.
The other thing is that I'm not entirely sure if the fix I did is right. It seems to me that it is fixing a symptom.
If in some cases it comes into AddBehaviors method twice with the same parameters and on a second call I got an exception it is possible that this line
if (burden != null) burden.Add(behavior);
also should not be performed.
from windsor.
you might be right. It's been a while since I looked into this code I'm not sure what the best way to fully fix this is. That's why it's good to have tests to make sure all is good and to validate all assumptions of potential issues like this one.
I'm not sure if you need both port sharing and admin. I thought one should be enough. Have a look why the other 16 tests are failing. Perhaps there's some configuration that needs to happen.
I do agree that the experience getting up and running is less than ideal. sorry about that.
from windsor.
Couldn't replicate issue. But eventually I did.
My problem partly was because of my laziness. I started using this for registration
Classes.FromAssemblyContaining<SomeType>().Pick()
.WithService.DefaultInterfaces().LifestyleTransient()
As result it added component with a service ArchiveSerializerContractBehaviorAttribute
, IContractBehavior
because in that assembly I have that class
public class ArchiveSerializerContractBehaviorAttribute : Attribute, IContractBehavior
in ServiceHostExtensions.cs
void IWcfExtensionVisitor.VisitEndpointExtension(IWcfEndpointExtension extension)
{
var contracts = new HashSet<ContractDescription>();
#if !DOTNET35
var endpoints = serviceHost.Description.NonSystemEndpoints();
#else
var endpoints = serviceHost.Description.Endpoints;
#endif
foreach (var endpoint in endpoints)
{
extension.Install(endpoint, contracts.Add(endpoint.Contract), kernel, burden);
}
}
at the line extension.Install(endpoint, contracts.Add(endpoint.Contract), kernel, burden);
endpoint already has a required behaviour and in Install method it will add and fail at that. The first solution was just to remove registration and I did this way
Classes.FromAssemblyContaining<ISystemLoad>()
.Where(t => !"ArchiveSerializerContractBehaviorAttribute".Split(' ').Any(s => t.Name.Contains(s)))
.WithService.DefaultInterfaces().LifestyleTransient()
At that moment I started realizing that if I would not have interface marked with that attribute it would add succesfully the registered contract behavior and as result I would have
behavior which I didn't ask.
in WcfUtil.cs
in that method
internal static void AddBehaviors<T>(IKernel kernel, WcfExtensionScope scope,
ICollection<T> behaviors, IWcfBurden burden,
Predicate<T> predicate)
{
foreach (var handler in FindExtensions<T>(kernel, scope))
{
var behavior = (T)handler.Resolve(CreationContext.CreateEmpty());
if (predicate == null || predicate(behavior))
{
if (behaviors != null) behaviors.Add(behavior);
if (burden != null) burden.Add(behavior);
}
}
}
FindExtensions<T>(kernel, scope)
finds all components which are registered in the container and adds them to the endpoint.
Is that how it is supposed to work or is it a bug? I don't think that I need extensions which I didn't ask explicitly.
from windsor.
2 kkozmic
Can you have a look into the last post.
from windsor.
sorry accidentally closed
from windsor.
:)
from windsor.
Is that how it is supposed to work or is it a bug? I don't think that I need extensions which I didn't ask explicitly.
from windsor.
extensions? What extensions?
from windsor.
Please read my post (5days ago). The problem is that if in the container a class which implements IContractBehaviour was registered this behaviour will be added to a service even if I didn't mark contract with that attribute.
from windsor.
Hmm, @cneuwirt what's your opinion on this, specifically #44 (comment) ?
from windsor.
@Alex2357 - this issue has not moved for 3 years, OK to close? Ideally we would like to see a pull request raised. Do you feel this is possible?
from windsor.
Abandoned issue, closing.
from windsor.
Related Issues (20)
- OWIN Self-hosted mode "perwebrequest" lifecycle
- WindsorScopedServiceProvider remains in scope captured at resolve-time (Scope cache was already disposed)
- windsor 5.1.2 Lifestyle Prewebrequest HOT 4
- .NET 6 - Get ServiceProvider Service from MS DI Extension before build() HOT 4
- NET 6.0 ForcedScope Failed with "No Available Scope" on GET request HOT 38
- Using xml-config file for dynamic loading of plugin dll doesn't work in Net6 HOT 1
- how to get a System.Runtime.Remoting.Proxies._TransparentProxy by WindsorContainer HOT 1
- Can't create a logger due to out of date example code and documentation. HOT 1
- Duplicate named registrations fails silently when using BasedOnDescriptor.Configure HOT 1
- NET 6.0 The ISupportInitialize interface methods are not called HOT 1
- Property injection for type registered with DynamicParameters
- Missing package Castle.Windsor.Extensions.Hosting HOT 1
- NuGet.org automatic publishing missing `Castle.Windsor.Extensions.Hosting`
- NuGet packages still using deprecated `licenseUrl` element HOT 2
- Support for IAsyncDisposable
- Async version of IStartable interface for Castle Startable facility
- Occasional InvalidOperationException - "Can't find information about factory method..." HOT 1
- Azure Service Bus implementation issue using castle Windsor in net core 6.
- Blazor Support
- MissingMethodException: IKernel IHandler.GetKernel()
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 windsor.