Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple instances of the exact same service #26

Closed
bonesoul opened this issue Jul 17, 2014 · 6 comments
Closed

Multiple instances of the exact same service #26

bonesoul opened this issue Jul 17, 2014 · 6 comments

Comments

@bonesoul
Copy link
Collaborator

@Astn In CoiniumServ we need to host multiple instances of exact same service which those can just listen on different ports and have different contextual information.

Though getting this exception;

An exception of type 'System.ArgumentException' occurred in mscorlib.dll but was not handled in user code

Additional information: An item with the same key has already been added.

----
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at AustinHarris.JsonRpc.SMD.AddService(String method, Dictionary`2 parameters, Dictionary`2 defaultValues) in d:\temp\tmp613C\Json-Rpc\SMDService.cs:line 41
   at AustinHarris.JsonRpc.JsonRpcService.buildService(String sessionID) in d:\temp\tmp613C\Json-Rpc\JsonRpcService.cs:line 60
   at AustinHarris.JsonRpc.JsonRpcService..ctor() in d:\temp\tmp613C\Json-Rpc\JsonRpcService.cs:line 14
   at Coinium.Server.Mining.Stratum.Service.StratumService..ctor(IShareManager shareManager) in e:\Coding\CoiniumServ\src\CoiniumServ\Server\Mining\Stratum\Service\StratumService.cs:line 39
   at lambda_method(Closure , Object[] )
   at Nancy.TinyIoc.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)

Any workarounds?

@bonesoul
Copy link
Collaborator Author

Guess may related to this?

var newDel = Delegate.CreateDelegate(System.Linq.Expressions.Expression.GetDelegateType(paras.Values.ToArray()), this /*Need to add support for other methods outside of this instance*/, meth);

@bonesoul
Copy link
Collaborator Author

Okay supplying a call to base service constructor with unique name seem to fix the issue.

@bonesoul
Copy link
Collaborator Author

I guess I've to now find a way to use the correct service for a request.

@bonesoul bonesoul reopened this Jul 17, 2014
@bonesoul
Copy link
Collaborator Author

Calling JsonRpcProcessor.Process() with instanceId fixed the issue.

@Astn
Copy link
Owner

Astn commented Jul 18, 2014

Sweet! Glad you got it working.

@Astn
Copy link
Owner

Astn commented Jul 18, 2014

This is related to: #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants