« first day (248 days earlier)      last day (4683 days later) » 
04:00 - 17:0017:00 - 23:00

5:18 PM
hi developers ...
 
hi user
 
how is it going
 
not too much
still trying to get friends with WCF and callbacks
how are you ?
 
too tired ... exhausted actually .... i been searching for an answer since yesterday evening ... and guess what, its also WCF .... !!!
 
har har :)
What's your problem?
 
5:29 PM
i have a wcf service, i want to host it for about 5 clients, the problem is, that these clients will be exposed different methods, so basically IService would differ for all .... so i was hopping instead of creating a seperate service and hosting sepertely for each client on IIS, i could use different endpoint for each client .. but this endpoint thing is not working
 
AFAIK endpoints are meant to enable different transportation mechanisms (TCP, NamedPipes, the lot)
 
i am not sure i got u, or may b i am completely going in wrong directin.... u mean i should create seperate service for all clients???
have a look at this stackoverflow.com/questions/6428838/… this is my question .... let me know if it makes any sense to u
 
you shouldn't ask questions twice, as you might have already noticed :) SO users are a bit ... err... 'special' about it
well. As I told you: From my understanding of WCF, endpoints are not meant for this and you will need to implement another WCF service (interface) for each client connecting
or you could search for another approach. Maybe just tell us what you are trying to achieve
 
5:45 PM
yeh i guess so ... no body answered to my first one, i mean 1 did, but thats was completely out of the context .... i'll take care next time ....
k
i'll tell what i am trying to achive
i have 5 clients
5 will be consuming my webservice, to get some data from my db
for each of them, methods are different, in some cases there are few methods that are same for 2 clients ... but that can not be guaranteed ....
 
in what way do those 5 clients differ ?
 
they are of same industry .... but depending on their contract with us, they will be provided with set of methods they can use to query our databases ....
and there will be more clients coming in it could go up to 20-25
now instead of having 5 WCF projects, and then hoting each of them seperately on IIS
 
so those clients are basically your customers
 
yeh
 
and you are trying to implement some sort of role management
 
5:50 PM
not exactly management, its a service, from us to them, depending on what they have paid us (on what tariff they are)
 
yeah sure. But what you want is a sort of role management
i.e. allow client 1 to take action A, client 2 to take action B, client 3 to take action A+B
am I right?
 
i dont want to get into roles at this stage, because there will be roles within clinets as well, so users belonging to group A of a client will have some differnt features than group B
but yeh
its a group thing at client level as well
 
however you like to call it, to me this is role management :)
 
k ...
 
hmm. What about the rest in here? @MartinhoFernandes would you agree on that ?
 
5:55 PM
@yas4891 If every user is doing more or less the same kinds of things with the DB, but their tariff determines what they're allowed to do, then yep, it sounds like authentication + authorisation to me, not separate contract interfaces
 
@shambulator thanks for your opinion.
@user402186 I'd suggest to read up on how to implement role management. Get your nose into "Head First: Design Patterns"
@user402186 As far as I remember, they adress that type of problem in there and show how to solve it using the Proxy Pattern
 
the underlying databases are different for each client ... i was hoping if i can create a Service.svc.cs, which implements IClientA, IClientB ... the then depending the request came from which endpoint the Service.svc.cs connects to that db and gets its request ...
was that a bad idea?
@shambulator thanks for the openion
 
don't know. I still think that you'll fare better with using one general contract for all clients and then throwing design patterns at your problem :)
 
let me process ur idea in me head ...
 
@user402186 are the database schemas pretty much the same? and are the operations in IClientA, IClientB, etc. all the same? If A is on a lower tariff than B, can they do a subset of the things that B can do, or something completely different?
If the functionality of lower tariffs is a subset of higher ones, and everyone uses the same (or mostly similar) DB schemas (but different DBs), then you should use only one interface. Your authentication system determines who you're talking to, then you can use that to decide which DB to use and what they're allowed to do to it.
 
6:03 PM
@sha
sorry
@shambulator yeh its prety much like u said
schema are same, operations are same
but about subset thing its not always same
 
@user402186 then go for one interface and apply a whole bunch of design patterns ^^
 
some clients have completely different tariff that dosent have any thing to do with other tariffs
i can do one interface
but then one question remains
the users depending on what role he belongs to, will be allowed to access certain methods ... but i can not restrict from users about what are the total avaliable exposed methods .... can i? .... if all users see all methods signatures .... is that ok form the design and industry practice point of view?
 
I'd say so. Just throw them an exception whenever they try to fool around with methods they are not supposed to use
 
@user402186 You can, but you don't do it by giving each user a separate endpoint. You have to set your service up to authenticate users (e.g. using username and password), then based on the users who log in, you can allow or deny access to methods
will see what links I can dig up that might help
 
that can be done .... but is that a good approach ... i mean users seeing the names (signatures) of methods even if they are not allowed to use them .....
 
6:09 PM
@shambulator I think he wanted to know whether or not it is OK for the user to see those methods (like in IntelliSense)
 
yup
 
ah, I see
 
@user402186 IMHO I think that is perfectly OK. As I mentioned above: Throw exceptions
 
depends on your situation I suppose. in general that should be fine. you'd go to a lot of effort to hide them for not much benefit, when the important bit is preventing people from calling them unless they're authorised to
 
my boss wont be very comfortable with that .... coz these "clients" are also competitors, and the name of methods may disclose what type of task that method does, and that task can point out who could be the client using that method ... u c what i mean .....
i like that approach too ....
 
6:13 PM
yeah well.... I once read something quite inspiring: "Don't try to obfuscate your code too hard. It can be cracked anyway. Try to build better software than your competition"
 
hehehe ..... i love that approach that you guys are suggesting .... (and in the end i may use it also), am just trying to know if there is any way i can do my work according to good practice, an
d keep my boss happy ... ;)
 
keep your code free from bugs. That'll please him ;-)
 
lol
ture
ok
lets just say
that i cant do the above ... then i think the only way is to create bulk of services for each client .... yeh
(i want to know this, so that i can use ur approach ..... )
 
specifically so you can hide sensitive information in method signatures?
 
i dont want to have a feeling, that there may be some good way, but i didnt digged to hard ....
@shambulator yeh
 
6:19 PM
@user402186 that may be pretty messy, but how about using very general method signatures (instead of using different contracts per client) and specifying the behaviour with a bunch of Enums / strings / whatever
If you are really willing to 'obfuscate' this
this might be easier to implement (but pretty ugly)
 
mmm
 
in that case, I would make the signatures less specific: rather than have e.g. void CompanyXPerformTransactionY(double amount), have void PerformTransaction(TransactionDescription td)
and have your parameters be more complex but hide the specifics
 
@shambulator LOL ...
 
k lets if i take this
 
fools seldom differ ;-)
 
6:21 PM
if create 1 service
 
with roles and users
roles would be clients
 
or rather say "great minds think alike" ;-)
 
@yas4891 yeah, think I'll take that one for the ballad they write about us one day
 
then what i'll do for the sub roles with in the clients?
 
6:24 PM
@shambulator :-)
 
ok, before this gets really confused, let's agree on some terminology :)
user = 1 person, who works for one of your clients
client = 1 company for whom you're providing the service
role = a set of allowed operations on a database
 
wait
 
so: you expect to have multiple users per client, where each user can have a different role (has different access to their company's database)
 
i'll re write
clients are the one who have databases with us ...
we will expose service for them
these clients will have about (1-2 or at most 3) different level of roles, that they want their sub clients to be using the service
earlier
all clients were having seperate WCF hosted application
and roles identified the sub clients of that particular client
so if decide to give roles to OUR clients
how do i sub devide the logic for their clients
?
 
It's just a matter of how many levels of groups / roles you allow
 
6:29 PM
so it will be
role A
role B
role C
 
say you have group 1, which is part of group 2
 
one way would be: you have a bunch of logins. One login is basically one username/password combination. Every login is associated with a client (so it goes to the right DB) and one or more roles (which determine what the login can do with the DB)
 
and you have users in both of those groups, say user A in group 1 and user B in group 2
A can do all the things that groups 1+2 can, but B can only do things that 2 can
Quite a bit like it was done for Active Directory
 
@yas4891 yeh .....
@shambulator i like ur approach
 
Example structure:
Client A:
Login "superuser": roles "read everything", "write everything", "catastrophically destroy everything"
Login "normal user": roles "read the message of the day"
 
6:33 PM
yeh that sounds good
let me process it
 
Client B:
Login "root": roles "anything they like"
Login "bob": roles "post new blog entry"
depending on the system, you might be able to have the same set of roles for all DBs, or have DB-specific roles
 
wait am processing ...
or
can i not do like this (it might be more complex but will save me dozen of services .. )
no
forget it
 
I do like that "catastrophically destroy everything" feature. Quite like my beloved method called "GrabWorldDomination()"
 
hehehe
 
@yas4891 only problem is you can only do it once :P
@user402186 that'd be quite impressive, saving dozens when you can do it with one :)
 
6:37 PM
k
wait
i got one more idea
how about
roles for my clients
so user1, user2, user3, for my clientA
clientA is a role
and then if client wats user2 not to access a certain mentod, i'll put restrictions the same way i was doing for roles at user level as well
is that good
so basically
 
@user402186 would that involve removing user2 from clientA role?
 
@shambulator that is sadly true. But I might enjoy it for quite a bit :) give me pot and hookers
 
authorixation at roles and user level for each method
@shambulator no it wont invole removing user from role
yeh so authorize all users that belong to role client1, but do not let user2 in
 
say you have methods X, Y and Z. user1, user2 and user3 are all associated with clientA (not necessarily a role) but you could have roles per method. so user1 and user3 have role "Can Run Y"
then even within the Y method, you could have fine-grained roles. user1 might have the role "Don't log my actions in the audit trail", while user3 doesn't
 
if role is "can run y" and NOT the "clientA" the the grouping of the users are based on theie assesibility, and not the client, so i can not get all users of clientA, but i can get all users that can run y
that dosent sound like users under clinet umberella
coffee any one?
 
6:47 PM
hmm. to make administration easier, I'd suggest to use a "users in groups withhin groups" approach
pretty darn good idea
 
@user402186 the point being that each user can have many roles, and you can use a role to check pretty much anything you like
(milk, no sugar. thanks!)
 
@yas4891 its good .... but is that even possible, 1 role, under another role .... (especially the ASP Roles)
@shambulator getting ready ....
 
well... I thought you'd define your own set of roles
and then do it composite pattern style
 
if you're using ASP.NET membership and roles, the story gets even better :) WCF has support for the forms authentication stuff
 
that would be the last thing i would want to do
 
6:50 PM
I'm in a 'design patterns' mood today :)
 
lol
 
I am in fact maintaining a service which does exactly this, except the roles bit, at work at the moment
 
i am also using ASP membership with WCF here at work, but this roles with in roles has got thing out of hand ....
thats the problem
how to manage that bit
 
Unless I'm missing something, you shouldn't need roles within roles. The login tells you which database to use, the login's roles tell you what you're allowed to do it, or which methods you're allowed to call, etc.
 
so there can b 5 logins going to one DB ... ?
 
6:54 PM
yep
the place where I'm storing that association is in the ASP.NET profile database
 
guys: I managed to get a WCF callback running with strings.
 
but it could be anywhere
 
thats not nice, i want to put users under client umberella
 
@yas4891 nicely done :)
 
Anyone knows how to get it up and working with custom class ?
 
6:55 PM
@yas4891 gud gud
 
@user402186 in what sense? I understand user1, user2 and user3 to be under the umbrella of client A because they all have a row in the authentication DB linking them to client A's database
@yas4891 should be exactly the same way, just remember the [DataContract]s
 
did that. It's working when I return them from a service method
like "TransmissionClass get()" on the host
but I want to asynchronously send the TransmissionClass object from the server to the client
 
@user402186 so the process is: user1 calls method X, X gets ASP.NET authentication result and sees "user1" is the IPrincipal. Runs a query: select clientId from clientUsers where userid = 'user1'. Follows up with: select databaseName from clients where clientId = <user's client id>
 
@shambulator rite .... i'll give it a thought over night .... i think that can be done ..... let me think about it ...... or if i get some other thing in my mind .....
 
@yas4891 and what's it doing at the moment?
 
7:02 PM
am off to starbucks now ... (u r welcome if you wana join .... )
 
@user402186 thanks :) hope we could help a bit
 
thank you very much for the intellectual dev talk .... i'll probably see you guys tomorrow if you come here regularly ....
 
no idea about regularly, today's the first time I've ever used SO chat :)
 
me too
lol
laterz then ..... am too exhausted thanks @yas4891 and @shambulator
bye....
 
@user402186 cheers!
 
7:07 PM
@user402186 You're welcome :)
@shambulator System.ServiceModel.FaultException sth
Das Element "http://tempuri.org/:aUpdatedObject" enthält Daten eines Typs, der dem Namen "http://schemas.datacontract.org/2004/07/ServerApp:TransmissionClass" zugeordnet ist. Dem Deserialisierungsprogramm ist kein Typ bekannt, der diesem Namen zugeordnet ist.
 
what's the UpdatedObject class? does it have a [DataContract]?
 
please stay tuned. I'm currently writing up a question on that
It will contain the code
Is it OK to use pastebin?
 
if you can put a shorter snippet directly in the question, it'll probably go down better with the denizens of SO
I'm ok with pastebin though
 
Yeah. I'll have a mixture. But I don't want to obfuscate the post with lines and lines of code
where do I need to put the KnownTypeAttribute ?
 
@yas4891 off the top of my head though, there's a type in your class hierarchy which either a) doesn't have a [DataContract], or b) is a subclass of a DataContract type, which means you need to use KnownTypeAttribute to let the deserialiser know to expect it
:D there's that great minds routine again. it needs to go on any base types which might actually be derived types at runtime
 
7:15 PM
0
Q: WCF: Use custom class in callback

yas4891I've managed to get WCF callback (over NamedPipes) working with strings, but I sadly can't get it to work with custom classes. Here's the service declaration + implementation: http://pastebin.com/Zayi2kjT here is my data contract: http://pastebin.com/wFCxrRcJ here is what I'm doing on the cli...

I can post the whole solution as well, if need be
it's just a small test project. I try to get myself familiarized with WCF and test things out for production code
@shambulator I need to add the KnownClientAttribute where exactly on the client?
 
7:30 PM
@shambulator to the rescue!
 
7:55 PM
someone still here?
 
yup, sorry about the delay
will probably have to take a look tomorrow!
 
no problem, mate
 
suspect the problem is with the use of object in the client callback though
 
GOOD LORD!
no kidding...
that's true. Changed the parameter type to TransmissionClass
 
8:01 PM
hmm. Only bad thing about this is, that I'd like to code against an interface
but I guess that won't be possible for DataContracts - right?
 
hmm, apparently not - looks like KnownType can only be applied to classes or structs
but you might be able to have an interface member on a class
 
good gracious lord. So I'll have to make all classes used to transmit data available in the library
which seems to be quite plausible, but also I can't declare an interface to code against ?
but well.. OTOH this is supposed to be an immutable class only for transmitting data
I guess I'll can be fine with that
 
yep you have to ship the contracts either over the wire in the service definition or in an assembly package
 
I guess that's OK
So I'll just have to figure out how to do non-blocking multicast
and why the first invocation of the callback seems to take like forever
 
the last part
is most likely JIT compilation and waking up everything in WCF
 
8:15 PM
@ChrisMarisic terrific point
 
i remember back when i worked at aplace that did heavy WCF stuff we had a ping service that just whacked the service every 5 minutes to never let it sleep
i believe that could potentially be avoided nowadays using IIS 7.5 and setting the app pool that hosts the WCF service to be set to AlwaysRunning
the other major performance things i remember were making sure all the ngen stuff happened
i think thats a nonissue now that VS is smart enough to do all of that for release publishes
 
o_O
I'm so incredibly glad that I'm first doing all of this in a test application and not refactoring production code right know.
that sure was the right thing to do
 
yeah WCF is a very complex beast
i use MVC3 controller actions +JSON for services now
 
that is ASP stuff - right? I'm into a self hosted app
I'll go to bed now
good night folks
 
cya yas
 
8:30 PM
@shambulator don't forget to write an answer, so I can mark it!
@ChrisMarisic where are you from?
 
Harrisburg PA USA
 
oh :) So it's about 1700 hours at your place ?
16:32 says google
I'll be to the states in about one year (at least I hope so)
 
vacation, school, work?
 
part vacation, part work
I'm currently at university and the best graduating students will get a tour through the USA
NY, D.C., West Point
 
those are cool cities, i've never been to west point
in DC try to check out the smithsonian museums
 
8:44 PM
Will do. But I expect the schedule to be pre-arranged and tightly packed
I'm really looking forward to seeing the USMA at West Point. This will definitely be one of the highlights
although I guess there won't be much interaction with cadets there
 
yeah id have no idea what ot expect
i'd imagine it just looks like a school
except alot of people wear the same clothes lol
of course there might be some tanks in the front yard
 
I guess not. I bet this is all about learning the basics. So no fancy gear there :)
and from what I know they do a lot of classes. Just like we do over here
hanging around at university instead of doing some soldiering
hmm. USA is planning to withdraw 30k troops from AFG until the end of 2012
 
9:23 PM
fuck withdrawing 30K
we won, it's time to come home
from all of our wars =/ especially the illegal obama war in libya
Have a good night everyone!
 
@ChrisMarisic ok??
0
Q: Performance update - Better image framerate in WPF

NasenbaerI am working in WPF in .Net 4.0. I have some huge images from camera 1392x1040 pixels. Every frame comes as System.Drawing.Bitmap and will be converted into a BitmapImage by using Public Function BitmapToWpfBitmapSource(ByVal bmSrc As System.Drawing.Bitmap) As BitmapSource If...

 
 
1 hour later…
10:36 PM
hi
 
04:00 - 17:0017:00 - 23:00

« first day (248 days earlier)      last day (4683 days later) »