I have a wcf service setup for windows authentication. I have a silverlight application that allows users to navigate the web pages based on Active Directory windows authentication and there group roles. The problem I am having is that my wcf service does not allow for role based group security. Because of this, any active directory user is able to call any of the wcf service's web method no matter what their group role is. I need to setup my wcf service to only allow users in certain roles to call a subset of the services web methods. Please help.
That said you should also consider what is likely to happen rather than trying to adjust to all possible outcomes. Normally you are unlikely to do more than add new attributes to existing entities. More significant changes should require a version (specified via the base url) change.
Other than that I would consider your base class example (Employee/Person) suspect because it should only occur if someone badly messed up the original architecture.
This is not at all true. An object that is published in a webservice can be used
with in the system publishing the service. If that system decides to extend the
object for whatever reason it should be allowed to with out breaking its
publishing, thus having to version etc.
That however is not what I said.
The fact that something is possible doesn't mean that all possible scenarios that lead to that possibility are good.
Your example demonstrates something that in all likelyhood started with a poor design and someone attempts to 'correct' it (hopefully not just making the original bad design worse.)
In fact, for all purposes that is how it will be serialized. This is in fact
common refactoring practice (not poor design adjustments).
I know how inheritance works.
They way I read this entire thread was that the FIRST version (where you used "at first" in the OP) of the web interface would have a data object which did not use inheritance.
Then the SECOND version of the web interface, where I assumed it was second because you said "will the client still receive", was adding inheritance.
Thus one started with a public facing design for the first version and it was released that way. Then the decided that the second version would use inheritance, in the public facing api.
A public facing interface is not a simple implementation and should be given a thorough review BEFORE implementing to it. To rework it in version two with the specific semantics suggested with the expectation that version 1 clients should still consume it, strongly suggests that the original design was poorly thought out.
The most important factor in the above is not whether inheritance or not should be used but rather that it is public API.
But regardless of that inheritance should be used carefully in all code and most of the time a public web interface should not be using it (just as mos code should not use it.) This also is another factor that suggests that the sequence (design of 1 leading to 2) is somehow flawed.
Collin Jasnoch wrote:
Please read posts more carefully before critizing someones 'simple' example as a
poor design. There was no design in it. It was meant to be an example for clear
question that would obtain a clear answer.
First I didn't claim that it was absolutely a poor design but rather it likely was. And I was referring to a real implementation of such a design and NOT just the example.
Second, it appears that you are distancing yourself from the fact that it is a represents a design in the first place.
So let me make it more clear what I said...
If such an implementation existed in version one of a public API and if ones follow up solution in version two was to use inheritance then that suggests that there is a design flaw either in version one, two or both.
To which you did not answer but provided a link. Useful link, but still not an
actual answer. Move along, nothing to see here.
To be clear actually I also said
"DataMember has Properties which can change the behavior."
My first inclination was to post just the properties but I thought that link was better since it was the one I used to base the standards on which my company, based on their practices, needs and expectations, moves forward in adopting to new versions of web interfaces.
Other companies have different needs and as such they should come up with their own approach. One can't do based solely on the need to use a web interface, but rather it must also take into account the business needs of the company.
Collin Jasnoch wrote:
Who the frak cares about poor design or any design for that matter in this
Still not clear...you are both defending the design and claiming that it isn't a design.
As I made clear several times if that was a design then it suggests a problem. So you are stating it isn't a design thus you do not need to defend it as such.
I have a Silverlight application using WCF. Now, I can get the wcf service to talk to the application with Anonymous Authentication enabled; however, I do not want Anonymous Authentication enabled as I want to use Windows Authentication. I have tried making changes to the WCF web.config and the Silverlight References.ClientConfig but nothing seems to work. If possible please provide as much details as possible. Thanks in advance.
I need to write an WCF service which would be accessed from iPhone/Android phone application.
WCF service should provide chat functionality and other required end point methods to the installed phone application.
Here I have few queries:
1. Can we implement duplex communication for this, between wcf service and iphone / android application?
2. What would be better solution, hitting a WCF webservice from phone application after some interval of time or putting some callback in phone device?. As i need some chatting kind behaviour in phone where two phone user should chat to each other through the connected WCF service.
Can you please suggest approach and helpful links for same.
AddServiceEndpoint(typeof(ILiveChatService), new CustomBinding( pdbe, new TextMessageEncodingBindingElement(MessageVersion.Soap11,System.Text.Encoding.UTF8), new HttpsTransportBindingElement()),"");
==========================Exception============================Error 3 Argument 1: cannot convert from 'System.ServiceModel.Channels.PollingDuplexBindingElement' to 'System.ServiceModel.Channels.BindingElement' E:\facebook chat\SilverlightApplication1\LiveChatService\LiveChatServiceHost.cs 31 77 LiveChatService
Error 2 The best overloaded method match for 'System.ServiceModel.Channels.CustomBinding.CustomBinding(params System.ServiceModel.Channels.BindingElement)' has some invalid arguments E:\facebook chat\SilverlightApplication1\LiveChatService\LiveChatServiceHost.cs 31 58 LiveChatService
Error 1 The type 'System.ServiceModel.Channels.BindingElement' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ServiceModel, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. E:\facebook chat\SilverlightApplication1\LiveChatService\LiveChatServiceHost.cs 24 13 LiveChatService
I hear about WCF as a new tool which is able of implements the applications as Services, but after look for it`s funcionality I see that it cover some protocols, security, Error control, but endly it's functionality is no so different of traditional asmx Web Services, they offer some methods and one client can access such methods and collect some objects, so I don't see so much possibilities.
please could you tell me something that I don't see in order to understand how WCF help to create RIA applications, that asmx services don't do
In my opinion, the major WCF advantage is extensibility and flexibility. It isolates different aspects from the interface (Contract) that the service implements. Examples are:
-How data is transfered: SOAP, TCP, JSON, MSMQ)
-Security (authorization, authentication)
The framework had many implementations for the above aspects and you can implement your own, for example is an open source project that provide binding for transfer over SMTP (email).
You can intercept the WCF pipeline to add some required behaviors or choose from already implemented one.
If you right click on your service reference in Project Explorer, you should see Configure Service Reference as an option in the context menu. If you select this, a dialogue will be shown with various options which you can use to set up your service. One option, in the Data Type section reads - Collection Type and shows a Drop Down with all the various types of Arrays, Lists etc. Just select List, press OK and you are good to go.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
this seems to be easy, but i just cant find right answer.
i have WCF duplex service to host online poker game (silverlight on client). if one client plug of his cable or meteor strikes at his home i need to disconnect him. it is easy to implement method Disconnect, but i cant call it if user is unsuspectedly disconnected...
my approach is:
1. enter - open page
2. connect - client calls method Connect wich is OperationContract on server; server have array field of all connected clients - CallbackContract
3. do something - send to server your move (irrelevant logic for this question)
4. check clients - this is what i dont have. i want to remove disconected users from my array field of all connected clients
5. recive info - server says what happend to all clients via CallbackContract
OperationContext.Current.Channel.Closed and OperationContext.Current.Channel.Faulted sounds like what i need, but they act strange?
publicclass Poker : IPokerService
if(appContext == null)
appContext = HttpContext.Current;
Dictionary<string, IPokerClient> ClientList
object temp = AppContext.Application["ClientList"];
if (temp == null)
temp = new Dictionary<string, IPokerClient>();
AppContext.Application["ClientList"] = temp;
return (Dictionary<string, IPokerClient>)temp;
publicvoid Connect(string id)
Dictionary<string, IPokerClient> clientList = ClientList;
IPokerClient client = OperationContext.Current.GetCallbackChannel<IPokerClient>();
clientList[id] = client;
OperationContext.Current.Channel.Faulted += new EventHandler(Channel_Faulted);
OperationContext.Current.Channel.Closed += new EventHandler(Channel_Closed);
void Channel_Closed(object sender, EventArgs e)
void Channel_Faulted(object sender, EventArgs e)
//this looks like place where to disconect (remove from "ClientList" ) user, but it is weird? sometime it fires on random on "alive" users, sometime it send correct "dead" user (example: after temp.Value.HelloWorld(); from below is invoked) sometimes not?
//since i dont understand how "Channel_Faulted" works, idea was to create function TestClient
Dictionary<string, IPokerClient> clientList = ClientList;
foreach (KeyValuePair<string, IPokerClient> temp in clientList)
foreach (KeyValuePair<string, IPokerClient> temp in ClientList)
//something is wrong, remove "temp" from "ClientList" //even here i cant do it right... sometimes it works if browser is closed sometimes not
am i doing something wrong? or anyone have any advice how should i do this?
I have been working on this one for week and I need help. It is complicated but I will try to explain what is going on and show a little code. What I have is a Silverlight application that communicates via WCF to the database. Now, the complicated part is that a windows job sends a UDP alert packet to each of the Silverlight clients to trigger an update of a DataGrid on the main page which does it update via the same WCF service Async call. This means that if I have 50 Silverlight clients when the alert packet is fired each of the 50 clients will make the same WCF call to the database. I have checked and insured that each client receives the UDP call. The problem is that when the clients all make the same call It gives me a wcf service error on some, but not all, of the clients. The code below shows the basic concept of the code in WCF service database call and Silverlight code. Of course the code is broken up into several sections, but you should get the main idea.
List<customer> clist = new List<customer>();
_sqlcommand = new SQLCommand();
The Service was not marked at all. What I did was mark it as ConcurrencyMode.Multiple. Do you think this is all I need to do? I have been testing with no initial problems. If this does take care of the problem then YOU ARE GREAT!
OK. After testing I have a bigger problem by marking the WCF Service as ConcurrencyMode.Reentrant or ConcurrencyMode.Multiple. Now after the first call that pulls the data from the database all other database calls, after that first call, fail. It is like the Service only performs the one (First) Get operation then all other database Get operations fail. Please help.
I'm in the process of investigating some random timeout exceptions on the client side when trying to connect to the service (possibly a network issue, possible a future question here). I'm not able to reproduce that error, but I in the process of tracking it down I did turn on WCF Tracing in our test environment to see what it showed on the server side, and to my surprise it showed a bunch of "Socket Connection Aborted" warnings, I think one for each call to the service.
My code to call the service looks like this:
var proxy = ServiceFactory.GetPolicyAdminWCF();
var returnValue = proxy.GetClaimDetail(ClaimID);
With the call to GetPolicyAdminWCF looking like this:
The client doesn't experience any problems, but I would think that if I'm doing everything right I would not be getting this warning on the server. Any ideas what could be causing this? Could a buildup of these warning eventually cause a random timeout from the client later?
I really think you're missing the part about there being no exception thrown and that code is executing successfully, but I'm willing to try anything so I did remove the try catch code from around the call to the service and the same thing happened. The code runs successfully, no exceptions are thrown on the client or the server, but when I turn on WCF tracing in the Web.Config like so:
Hello . I want to learn WCF but i do not know which book should i study before studying WCf . please tell me the lessons and nice books to start my study . By the way I know C#.net and sql server
and my level is intermediate in those