Search Results

Search found 15648 results on 626 pages for 'wcf security'.

Page 8/626 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How does LinqPad support WCF Data Services?

    - by user341127
    LinqPad supports WCF Data Services. If you assign an URL, such as http://services.odata.org/Northwind/Northwind.svc/. It will list all available data objects and you can query them. I guess LinqPad generates all available data classes at run time by reflection.Emit. I am wondering who can show me to how to do so. Or maybe someone has done it before. Any feedback are appreciated. Ying

    Read the article

  • Extending WCF Data Service to synthesize missing data on request

    - by Schneider
    I have got a WCF Data Service based on a LINQ to SQL data provider. I am making a query "get me all the records between two dates". The problem is that I want to synthesize two extra records such that I always get records that fall on the start and end dates, plus all the ones in between which come from the database. Is there a way to "intercept" the request so I can synthesize these records and return them to the client? Thanks

    Read the article

  • WCF how to pass token for authentication?

    - by Kevin
    I have a WCF service which would like to support basicHttpBinding and webHttpBinding. When the client successfully login, server will generate a token for client to pass to server on all the request make later. Question is how the client can pass the token to server? I don't want to add an extra parameter on every web method to hold the token.

    Read the article

  • WCF service monitoring

    - by Cicik
    I am writing WCF service hosted in WinForms application. Is there some way to monitor performance and statistics(count of instances, count of calls to endpoints, duration of calls, etc...) about service and display them in Form in which service is hosted?

    Read the article

  • Retrieve EF4 POCOs using WCF REST services starter kit

    - by muruge
    I am using WCF REST service (GET method) to retrieve my EF4 POCOs. The service seem to work just fine. When I query the uri in my browser I get the results as expected. In my client application I am trying to use WCF REST Starter Kit's HTTPExtension method - ReadAsDataContract() to convert the result back into my POCO. This works fine when the POCO's navigation property is a single object of related POCO. The problem is when the navigation property is a collection of related POCOs. The ReadAsDataContract() method throws an exception with message "Object reference not set to an instance of an object." Below are my POCOs. [DataContract(Namespace = "", Name = "Trip")] public class Trip { [DataMember(Order = 1)] public virtual int TripID { get; set; } [DataMember(Order = 2)] public virtual int RegionID { get; set; } [DataMember(Order = 3)] public virtual System.DateTime BookingDate { get; set; } [DataMember(Order = 4)] public virtual Region Region { // removed for brevity } } [DataContract(Namespace = "", Name = "Region")] public class Region { [DataMember(Order = 1)] public virtual int RegionID { get; set; } [DataMember(Order = 2)] public virtual string RegionCode { get; set; } [DataMember(Order = 3)] public virtual FixupCollection<Trip> Trips { // removed for brevity } } [CollectionDataContract(Namespace = "", Name = "{0}s", ItemName = "{0}")] [Serializable] public class FixupCollection<T> : ObservableCollection<T> { protected override void ClearItems() { new List<T>(this).ForEach(t => Remove(t)); } protected override void InsertItem(int index, T item) { if (!this.Contains(item)) { base.InsertItem(index, item); } } } And this is how I am trying retrieve a Region POCO. static void GetRegion() { string uri = "http://localhost:8080/TripService/Regions?id=1"; HttpClient client = new HttpClient(uri); using (HttpResponseMessage response = client.Get(uri)) { Region region; response.EnsureStatusIsSuccessful(); try { region = response.Content.ReadAsDataContract<Region>(); // this line throws exception because Region returns a collection of related trips Console.WriteLine(region.RegionName); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } Would appreciate any pointers.

    Read the article

  • Pattern for verifying authenticity of a request to WCF service

    - by fung
    I have a client app that makes calls to a WCF service. This app is on a public computer that's easily accessible and anyone can easily copy the .EXE and .CONFIG of my app into another machine and start using it. Is there a pattern where I can check if the request is coming only from an app on a computer I installed it on and not on one it has been copied to? Thanks in advance.

    Read the article

  • Passing Certificate to Svcutil to generate proxy for OSB Service

    - by webwires
    We are wanting to implement Two-Way SSL security from WCF to OSB Services. We have successfully deployed the certificates so that when you browse to the service with IE you get the appropriate prompt for certificate and then it takes you immediately to the WSDL. But, when you attempt to generate a proxy using svcutil as defined in steps 8 and 9 in this MSDN article. http://msdn.microsoft.com/en-us/library/cc949005.aspx I get the error: A reply message was received for operation 'Get' with action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get'. However, your client code requires action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse'. The OSB services are set to use Soap 1.2 and the svcutil.exe.config we use is identicle to the article except for the findValue and x509FindType. Instead we used the FindByThumbprint pointing to the "My" store name and "CurrentUser" store location. The cert is there and is the same cert we select from the IE prompt.

    Read the article

  • ASP.Net security using Operations Based Security

    - by Josh
    All the security stuff I have worked with in the past in ASP.Net for the most part has been role based. This is easy enough to implement and ASP.Net is geared for this type of security model. However, I am looking for something a little more fine grained than simple role based security. Essentially I want to be able to write code like this: if(SecurityService.CanPerformOperation("SomeUpdateOperation")){ // perform some update logic here } I would also need row level security access like this: if(SecurityService.CanPerformOperation("SomeViewOperation", SomeEntityIdentifier)){ // Allow user to see specific data } Again, fine grained access control. Is there anything like this already built? Some framework that I can drop into ASP.Net and start using, or am I going to have to build this myself?

    Read the article

  • Ignoring file 'eugenesan-java-quantal.list.save'

    - by Lupus
    I have a problem with my newly installed 12.10 86_64 Desktop. This error pops up on console when I try to update apt-get or try to install packages and nodejs just don't work and there is no error on console. Ignoring file 'eugenesan-java-quantal.list.save' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension this error started after my update on apt-get sudo apt-get update I'm a newbie on ubuntu. this is the log file : (in Turkish 'Yoksay' = Ignored, 'Baglandi' = Connected, 'getirilmesi basarisiz oldu' = failed to get ) attila@Lupuseum:~$ sudo apt-get update Yoksay http://security.ubuntu.com quantal-security InRelease Yoksay http://extras.ubuntu.com quantal InRelease Yoksay http://ppa.launchpad.net quantal InRelease Baglandi http://security.ubuntu.com quantal-security Release.gpg Baglandi http://extras.ubuntu.com quantal Release.gpg Yoksay http://cy.archive.ubuntu.com quantal InRelease Yoksay http://ppa.launchpad.net quantal InRelease Baglandi http://security.ubuntu.com quantal-security Release Baglandi http://extras.ubuntu.com quantal Release Yoksay http://cy.archive.ubuntu.com quantal-updates InRelease Baglandi http://ppa.launchpad.net quantal Release.gpg Baglandi http://security.ubuntu.com quantal-security/main Sources Yoksay http://cy.archive.ubuntu.com quantal-backports InRelease Baglandi http://extras.ubuntu.com quantal/main Sources Yoksay http://ppa.launchpad.net quantal Release.gpg Baglandi http://security.ubuntu.com quantal-security/restricted Sources Baglandi http://cy.archive.ubuntu.com quantal Release.gpg Baglandi http://extras.ubuntu.com quantal/main amd64 Packages Baglandi http://ppa.launchpad.net quantal Release Baglandi http://security.ubuntu.com quantal-security/universe Sources Baglandi http://cy.archive.ubuntu.com quantal-updates Release.gpg Baglandi http://extras.ubuntu.com quantal/main i386 Packages Yoksay http://ppa.launchpad.net quantal Release Baglandi http://cy.archive.ubuntu.com quantal-backports Release.gpg Baglandi http://ppa.launchpad.net quantal/main Sources Baglandi http://security.ubuntu.com quantal-security/multiverse Sources Baglandi http://cy.archive.ubuntu.com quantal Release Baglandi http://ppa.launchpad.net quantal/main amd64 Packages Baglandi http://security.ubuntu.com quantal-security/main amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates Release Baglandi http://ppa.launchpad.net quantal/main i386 Packages Baglandi http://security.ubuntu.com quantal-security/restricted amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports Release Baglandi http://security.ubuntu.com quantal-security/universe amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal/main Sources Baglandi http://security.ubuntu.com quantal-security/multiverse amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal/restricted Sources Baglandi http://security.ubuntu.com quantal-security/main i386 Packages Baglandi http://cy.archive.ubuntu.com quantal/universe Sources Baglandi http://security.ubuntu.com quantal-security/restricted i386 Packages Baglandi http://cy.archive.ubuntu.com quantal/multiverse Sources Baglandi http://security.ubuntu.com quantal-security/universe i386 Packages Baglandi http://cy.archive.ubuntu.com quantal/main amd64 Packages Baglandi http://security.ubuntu.com quantal-security/multiverse i386 Packages Baglandi http://cy.archive.ubuntu.com quantal/restricted amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal/universe amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal/multiverse amd64 Packages Baglandi http://security.ubuntu.com quantal-security/main Translation-en Yoksay http://extras.ubuntu.com quantal/main Translation-tr_CY Baglandi http://cy.archive.ubuntu.com quantal/main i386 Packages Baglandi http://cy.archive.ubuntu.com quantal/restricted i386 Packages Yoksay http://extras.ubuntu.com quantal/main Translation-tr Baglandi http://security.ubuntu.com quantal-security/multiverse Translation-en Baglandi http://cy.archive.ubuntu.com quantal/universe i386 Packages Yoksay http://extras.ubuntu.com quantal/main Translation-en Baglandi http://cy.archive.ubuntu.com quantal/multiverse i386 Packages Baglandi http://cy.archive.ubuntu.com quantal/main Translation-tr Baglandi http://cy.archive.ubuntu.com quantal/main Translation-en Baglandi http://security.ubuntu.com quantal-security/restricted Translation-en Baglandi http://cy.archive.ubuntu.com quantal/multiverse Translation-tr Baglandi http://cy.archive.ubuntu.com quantal/multiverse Translation-en Baglandi http://security.ubuntu.com quantal-security/universe Translation-en Baglandi http://cy.archive.ubuntu.com quantal/restricted Translation-tr Baglandi http://cy.archive.ubuntu.com quantal/restricted Translation-en Baglandi http://cy.archive.ubuntu.com quantal/universe Translation-tr Baglandi http://cy.archive.ubuntu.com quantal/universe Translation-en Baglandi http://cy.archive.ubuntu.com quantal-updates/main Sources Baglandi http://cy.archive.ubuntu.com quantal-updates/restricted Sources Baglandi http://cy.archive.ubuntu.com quantal-updates/universe Sources Baglandi http://cy.archive.ubuntu.com quantal-updates/multiverse Sources Baglandi http://cy.archive.ubuntu.com quantal-updates/main amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/restricted amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/universe amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/multiverse amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/main i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/restricted i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/universe i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-updates/multiverse i386 Packages Yoksay http://ppa.launchpad.net quantal/main Translation-tr_CY Yoksay http://ppa.launchpad.net quantal/main Translation-tr Yoksay http://ppa.launchpad.net quantal/main Translation-en Baglandi http://cy.archive.ubuntu.com quantal-updates/main Translation-en Hata http://ppa.launchpad.net quantal/main Sources 404 Not Found Hata http://ppa.launchpad.net quantal/main amd64 Packages 404 Not Found Hata http://ppa.launchpad.net quantal/main i386 Packages 404 Not Found Baglandi http://cy.archive.ubuntu.com quantal-updates/multiverse Translation-en Yoksay http://ppa.launchpad.net quantal/main Translation-tr_CY Yoksay http://security.ubuntu.com quantal-security/main Translation-tr_CY Yoksay http://ppa.launchpad.net quantal/main Translation-tr Yoksay http://security.ubuntu.com quantal-security/main Translation-tr Yoksay http://ppa.launchpad.net quantal/main Translation-en Yoksay http://security.ubuntu.com quantal-security/multiverse Translation-tr_CY Baglandi http://cy.archive.ubuntu.com quantal-updates/restricted Translation-en Yoksay http://security.ubuntu.com quantal-security/multiverse Translation-tr Yoksay http://security.ubuntu.com quantal-security/restricted Translation-tr_CY Yoksay http://security.ubuntu.com quantal-security/restricted Translation-tr Baglandi http://cy.archive.ubuntu.com quantal-updates/universe Translation-en Yoksay http://security.ubuntu.com quantal-security/universe Translation-tr_CY Baglandi http://cy.archive.ubuntu.com quantal-backports/main Sources Yoksay http://security.ubuntu.com quantal-security/universe Translation-tr Baglandi http://cy.archive.ubuntu.com quantal-backports/restricted Sources Baglandi http://cy.archive.ubuntu.com quantal-backports/universe Sources Baglandi http://cy.archive.ubuntu.com quantal-backports/multiverse Sources Baglandi http://cy.archive.ubuntu.com quantal-backports/main amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/restricted amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/universe amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/multiverse amd64 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/main i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/restricted i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/universe i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/multiverse i386 Packages Baglandi http://cy.archive.ubuntu.com quantal-backports/main Translation-en Baglandi http://cy.archive.ubuntu.com quantal-backports/multiverse Translation-en Baglandi http://cy.archive.ubuntu.com quantal-backports/restricted Translation-en Baglandi http://cy.archive.ubuntu.com quantal-backports/universe Translation-en Yoksay http://cy.archive.ubuntu.com quantal/main Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal/multiverse Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal/restricted Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal/universe Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-updates/main Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-updates/main Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-updates/multiverse Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-updates/multiverse Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-updates/restricted Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-updates/restricted Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-updates/universe Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-updates/universe Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-backports/main Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-backports/main Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-backports/multiverse Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-backports/multiverse Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-backports/restricted Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-backports/restricted Translation-tr Yoksay http://cy.archive.ubuntu.com quantal-backports/universe Translation-tr_CY Yoksay http://cy.archive.ubuntu.com quantal-backports/universe Translation-tr N: Ignoring file 'eugenesan-java-quantal.list.save' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension W: http://ppa.launchpad.net/richarvey/nodejs/ubuntu/dists/quantal/main/source/Sources 404 Not Found getirilmesi basarisiz oldu W: http://ppa.launchpad.net/richarvey/nodejs/ubuntu/dists/quantal/main/binary-amd64/Packages 404 Not Found getirilmesi basarisiz oldu W: http://ppa.launchpad.net/richarvey/nodejs/ubuntu/dists/quantal/main/binary-i386/Packages 404 Not Found getirilmesi basarisiz oldu E: Some index files failed to download. They have been ignored, or old ones used instead.

    Read the article

  • Authenticating clients in the new WCF Http stack

    - by cibrax
    About this time last year, I wrote a couple of posts about how to use the “Interceptors” from the REST starker kit for implementing several authentication mechanisms like “SAML”, “Basic Authentication” or “OAuth” in the WCF Web programming model. The things have changed a lot since then, and Glenn finally put on our hands a new version of the Web programming model that deserves some attention and I believe will help us a lot to build more Http oriented services in the .NET stack. What you can get today from wcf.codeplex.com is a preview with some cool features like Http Processors (which I already discussed here), a new and improved version of the HttpClient library, Dependency injection and better TDD support among others. However, the framework still does not support an standard way of doing client authentication on the services (This is something planned for the upcoming releases I believe). For that reason, moving the existing authentication interceptors to this new programming model was one of the things I did in the last few days. In order to make authentication simple and easy to extend,  I first came up with a model based on what I called “Authentication Interceptors”. An authentication interceptor maps to an existing Http authentication mechanism and implements the following interface, public interface IAuthenticationInterceptor{ string Scheme { get; } bool DoAuthentication(HttpRequestMessage request, HttpResponseMessage response, out IPrincipal principal);} An authentication interceptors basically needs to returns the http authentication schema that implements in the property “Scheme”, and implements the authentication mechanism in the method “DoAuthentication”. As you can see, this last method “DoAuthentication” only relies on the HttpRequestMessage and HttpResponseMessage classes, making the testing of this interceptor very simple (There is no need to do some black magic with the WCF context or messages). After this, I implemented a couple of interceptors for supporting basic authentication and brokered authentication with SAML (using WIF) in my services. The following code illustrates how the basic authentication interceptors looks like. public class BasicAuthenticationInterceptor : IAuthenticationInterceptor{ Func<UsernameAndPassword, bool> userValidation; string realm;  public BasicAuthenticationInterceptor(Func<UsernameAndPassword, bool> userValidation, string realm) { if (userValidation == null) throw new ArgumentNullException("userValidation");  if (string.IsNullOrEmpty(realm)) throw new ArgumentNullException("realm");  this.userValidation = userValidation; this.realm = realm; }  public string Scheme { get { return "Basic"; } }  public bool DoAuthentication(HttpRequestMessage request, HttpResponseMessage response, out IPrincipal principal) { string[] credentials = ExtractCredentials(request); if (credentials.Length == 0 || !AuthenticateUser(credentials[0], credentials[1])) { response.StatusCode = HttpStatusCode.Unauthorized; response.Content = new StringContent("Access denied"); response.Headers.WwwAuthenticate.Add(new AuthenticationHeaderValue("Basic", "realm=" + this.realm));  principal = null;  return false; } else { principal = new GenericPrincipal(new GenericIdentity(credentials[0]), new string[] {});  return true; } }  private string[] ExtractCredentials(HttpRequestMessage request) { if (request.Headers.Authorization != null && request.Headers.Authorization.Scheme.StartsWith("Basic")) { string encodedUserPass = request.Headers.Authorization.Parameter.Trim();  Encoding encoding = Encoding.GetEncoding("iso-8859-1"); string userPass = encoding.GetString(Convert.FromBase64String(encodedUserPass)); int separator = userPass.IndexOf(':');  string[] credentials = new string[2]; credentials[0] = userPass.Substring(0, separator); credentials[1] = userPass.Substring(separator + 1);  return credentials; }  return new string[] { }; }  private bool AuthenticateUser(string username, string password) { var usernameAndPassword = new UsernameAndPassword { Username = username, Password = password };  if (this.userValidation(usernameAndPassword)) { return true; }  return false; }} This interceptor receives in the constructor a callback in the form of a Func delegate for authenticating the user and the “realm”, which is required as part of the implementation. The rest is a general implementation of the basic authentication mechanism using standard http request and response messages. I also implemented another interceptor for authenticating a SAML token with WIF. public class SamlAuthenticationInterceptor : IAuthenticationInterceptor{ SecurityTokenHandlerCollection handlers = null;  public SamlAuthenticationInterceptor(SecurityTokenHandlerCollection handlers) { if (handlers == null) throw new ArgumentNullException("handlers");  this.handlers = handlers; }  public string Scheme { get { return "saml"; } }  public bool DoAuthentication(HttpRequestMessage request, HttpResponseMessage response, out IPrincipal principal) { SecurityToken token = ExtractCredentials(request);  if (token != null) { ClaimsIdentityCollection claims = handlers.ValidateToken(token);  principal = new ClaimsPrincipal(claims);  return true; } else { response.StatusCode = HttpStatusCode.Unauthorized; response.Content = new StringContent("Access denied");  principal = null;  return false; } }  private SecurityToken ExtractCredentials(HttpRequestMessage request) { if (request.Headers.Authorization != null && request.Headers.Authorization.Scheme == "saml") { XmlTextReader xmlReader = new XmlTextReader(new StringReader(request.Headers.Authorization.Parameter));  var col = SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection(); SecurityToken token = col.ReadToken(xmlReader);  return token; }  return null; }}This implementation receives a “SecurityTokenHandlerCollection” instance as part of the constructor. This class is part of WIF, and basically represents a collection of token managers to know how to handle specific xml authentication tokens (SAML is one of them). I also created a set of extension methods for injecting these interceptors as part of a service route when the service is initialized. var basicAuthentication = new BasicAuthenticationInterceptor((u) => true, "ContactManager");var samlAuthentication = new SamlAuthenticationInterceptor(serviceConfiguration.SecurityTokenHandlers); // use MEF for providing instancesvar catalog = new AssemblyCatalog(typeof(Global).Assembly);var container = new CompositionContainer(catalog);var configuration = new ContactManagerConfiguration(container); RouteTable.Routes.AddServiceRoute<ContactResource>("contact", configuration, basicAuthentication, samlAuthentication);RouteTable.Routes.AddServiceRoute<ContactsResource>("contacts", configuration, basicAuthentication, samlAuthentication); In the code above, I am injecting the basic authentication and saml authentication interceptors in the “contact” and “contacts” resource implementations that come as samples in the code preview. I will use another post to discuss more in detail how the brokered authentication with SAML model works with this new WCF Http bits. The code is available to download in this location.

    Read the article

  • Enabling Service Availability in WCF Services

    - by cibrax
    It is very important for the enterprise to know which services are operational at any given point. There are many factors that can affect the availability of the services, some of them are external like a database not responding or any dependant service not working. However, in some cases, you only want to know whether a service is up or down, so a simple heart-beat mechanism with “Ping” messages would do the trick. Unfortunately, WCF does not provide a built-in mechanism to support this functionality, and you probably don’t to implement a “Ping” operation in any service that you have out there. For solving this in a generic way, there is a WCF extensibility point that comes to help us, the “Operation Invokers”. In a nutshell, an operation invoker is the class responsible invoking the service method with a set of parameters and generate the output parameters with the return value. What I am going to do here is to implement a custom operation invoker that intercepts any call to the service, and detects whether a “Ping” header was attached to the message. If the “Ping” header is detected, the operation invoker returns a new header to tell the client that the service is alive, and the real operation execution is omitted. In that way, we have a simple heart beat mechanism based on the messages that include a "Ping” header, so the client application can determine at any point whether the service is up or down. My operation invoker wraps the default implementation attached by default to any operation by WCF. internal class PingOperationInvoker : IOperationInvoker { IOperationInvoker innerInvoker; object[] outputs = null; object returnValue = null; public const string PingHeaderName = "Ping"; public const string PingHeaderNamespace = "http://tellago.serviceModel"; public PingOperationInvoker(IOperationInvoker innerInvoker, OperationDescription description) { this.innerInvoker = innerInvoker; outputs = description.SyncMethod.GetParameters() .Where(p => p.IsOut) .Select(p => DefaultForType(p.ParameterType)).ToArray(); var returnValue = DefaultForType(description.SyncMethod.ReturnType); } private static object DefaultForType(Type targetType) { return targetType.IsValueType ? Activator.CreateInstance(targetType) : null; } public object Invoke(object instance, object[] inputs, out object[] outputs) { object returnValue; if (Invoke(out returnValue, out outputs)) { return returnValue; } else { return this.innerInvoker.Invoke(instance, inputs, out outputs); } } private bool Invoke(out object returnValue, out object[] outputs) { object untypedProperty = null; if (OperationContext.Current .IncomingMessageProperties.TryGetValue(HttpRequestMessageProperty.Name, out untypedProperty)) { var httpRequestProperty = untypedProperty as HttpRequestMessageProperty; if (httpRequestProperty != null) { if (httpRequestProperty.Headers[PingHeaderName] != null) { outputs = this.outputs; if (OperationContext.Current .IncomingMessageProperties.TryGetValue(HttpRequestMessageProperty.Name, out untypedProperty)) { var httpResponseProperty = untypedProperty as HttpResponseMessageProperty; httpResponseProperty.Headers.Add(PingHeaderName, "Ok"); } returnValue = this.returnValue; return true; } } } var headers = OperationContext.Current.IncomingMessageHeaders; if (headers.FindHeader(PingHeaderName, PingHeaderNamespace) > -1) { outputs = this.outputs; MessageHeader<string> header = new MessageHeader<string>("Ok"); var untyped = header.GetUntypedHeader(PingHeaderName, PingHeaderNamespace); OperationContext.Current.OutgoingMessageHeaders.Add(untyped); returnValue = this.returnValue; return true; } returnValue = null; outputs = null; return false; } } The implementation above looks for the “Ping” header either in the Http Request or the Soap message. The next step is to implement a behavior for attaching this operation invoker to the services we want to monitor. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class PingBehavior : Attribute, IServiceBehavior, IOperationBehavior { public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { } public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { foreach (var endpoint in serviceDescription.Endpoints) { foreach (var operation in endpoint.Contract.Operations) { if (operation.Behaviors.Find<PingBehavior>() == null) operation.Behaviors.Add(this); } } } public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters) { } public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) { } public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) { dispatchOperation.Invoker = new PingOperationInvoker(dispatchOperation.Invoker, operationDescription); } public void Validate(OperationDescription operationDescription) { } } As an operation invoker can only be added in an “operation behavior”, a trick I learned in the past is that you can implement a service behavior as well and use the “Validate” method to inject it in all the operations, so the final configuration is much easier and cleaner. You only need to decorate the service with a simple attribute to enable the “Ping” functionality. [PingBehavior] public class HelloWorldService : IHelloWorld { public string Hello(string name) { return "Hello " + name; } } On the other hand, the client application needs to send a dummy message with a “Ping” header to detect whether the service is available or not. In order to simplify this task, I created a extension method in the WCF client channel to do this work. public static class ClientChannelExtensions { const string PingNamespace = "http://tellago.serviceModel"; const string PingName = "Ping"; public static bool IsAvailable<TChannel>(this IClientChannel channel, Action<TChannel> operation) { try { using (OperationContextScope scope = new OperationContextScope(channel)) { MessageHeader<string> header = new MessageHeader<string>(PingName); var untyped = header.GetUntypedHeader(PingName, PingNamespace); OperationContext.Current.OutgoingMessageHeaders.Add(untyped); try { operation((TChannel)channel); var headers = OperationContext.Current.IncomingMessageHeaders; if (headers.Any(h => h.Name == PingName && h.Namespace == PingNamespace)) { return true; } else { return false; } } catch (CommunicationException) { return false; } } } catch (Exception) { return false; } } } This extension method basically adds a “Ping” header to the request message, executes the operation passed as argument (Action<TChannel> operation), and looks for the corresponding “Ping” header in the response to see the results. The client application can use this extension with a single line of code, var client = new ServiceReference.HelloWorldClient(); var isAvailable = client.InnerChannel.IsAvailable<IHelloWorld>((c) => c.Hello(null)); The “isAvailable” variable will tell the client application whether the service is available or not. You can download the complete implementation from this location.    

    Read the article

  • White Paper: How the Security Development Lifecycle Helped Improve the Security of the 2007 Microsof

    The 2007 Office system was the first Microsoft Office release to include the standardized Security Development Lifecycle (SDL) process throughout the product development life cycle. Read this paper to understand how the SDL contributed to improving the security of the 2007 Microsoft Office System....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • [GEEK SCHOOL] Network Security 7: Using the Action Center for Extra Security and Maintenance

    - by Ciprian Rusen
    In this lesson we will talk about another lesser-known security tool in Windows – the “Action Center”. This tool that has an impact on both how secure your system is and how well it is running from a maintenance perspective. The Action Center first made its appearance all the way back in Windows XP as the “Windows Security Center” and was such through Vista until being renamed in Windows 7.Click Here to Continue Reading

    Read the article

  • WCF service The maximum array length quota (16384) has been exceeded

    - by dmitry.baranovsky
    I have a wsf service and a client application. While trying to communicate the client and the service I've gotten the following message: "The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:blob. The InnerException message was 'There was an error deserializing the object of type FileBlob. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 25931.'. Please see InnerException for more details." I have the customBinding element and it doesn't allow me to insert "readerQuotas" section. In both the client and service configs I have the following binding element: <customBinding> <binding name="LicenseServiceBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"> <security authenticationMode="UserNameOverTransport"> <localClientSettings maxClockSkew="00:07:00" /> <localServiceSettings maxClockSkew="00:07:00" /> </security> <windowsStreamSecurity /> <httpsTransport maxReceivedMessageSize="2147483646"/> </binding> </customBinding> Thanks in advance for any help:)

    Read the article

  • WCF Http Bindings, Require SSL

    - by JoshKraker
    I have the following binding I'm using with my wsHttpBinding webservice. <binding name="wsHttpConfig"> <security> <transport clientCredentialType="None"/> </security> </binding> The issue is that it allows for the client to connect using either Http or Https. I would like to require them to use SSL. I tried adding the following: <system.web.extensions> <scripting> <webServices> <authenticationService enabled="true" requireSSL = "true"/> </webServices> </scripting> </system.web.extensions> But it had no effect; client could still connect with Http. I then tried checking the "Require SSL" in the IIS7 SSL Settings and had client certificates radio set to Accept. Now, when I try to view the service I am getting the error "Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https]." Anyone know exactly how to fix this error? I have been googling for the last 3 hours trying 500 different combinations (not 500, but too many to list) and could not get anything to run.

    Read the article

  • IIS error hosting WCF Data Service on shared web host

    - by jkohlhepp
    My client has a website hosted on a shared web server. I don't have access to IIS. I am trying to deploy a WCF Data Service onto his site. I am getting this error: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used. I have searched SO and other sites quite a bit but can't seem to find someone with my exact situation. I cannot change the IIS settings because this is a third party's server and it is a shared web server. So my only option is to change things in code or in the service config. My service config looks like this: <system.serviceModel xdt:Transform="Insert"> <serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix="http://www.somewebsite.com"/> </baseAddressPrefixFilters> </serviceHostingEnvironment> <bindings> <webHttpBinding> <binding name="{Binding Name}" > <security mode="None" /> </binding> </webHttpBinding> </bindings> <services> <service name="{Namespace to Service}"> <endpoint address="" binding="webHttpBinding" bindingConfiguration="{Binding Name}" contract="System.Data.Services.IRequestHandler"> </endpoint> </service> </services> </system.serviceModel> As you can see I tried to set the security mode to "None" but that didn't seem to help. What should I change to resolve this error?

    Read the article

  • WCF security when it is used with sync services

    - by malik
    I am using following architecture for sync process. http://www.codeproject.com/KB/smart/sync_services.aspx And for server i use WCF service, can anybody guide me how can i secure my wcf service without using certificate that is hosted on IIS. Can i get a way to pass credential or some token to authenticate? I need to authenticate and encrypt the communication, when syncagent call synchronise method.

    Read the article

  • WCF MustUnderstand headers are not understood

    - by raghur
    Hello everyone, I am using a Java Web Service which is developed by one of our vendor which I really do not have any control over it. I have written a WCF router which the client application calls it and the router sends the message to the Java Web Service and returns the data back to the client. The issue what I am encountering is, I am successfully able to call the Java web service from the WCF router, but, I am getting the following exceptions back. Router config file is as follows: <customBinding> <binding name="SimpleWSPortBinding"> <!--<reliableSession maxPendingChannels="4" maxRetryCount="8" ordered="true" />--> <!--<mtomMessageEncoding messageVersion ="Soap12WSAddressing10" ></mtomMessageEncoding>--> <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12WSAddressing10" writeEncoding="utf-8" /> <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="true" keepAliveEnabled="true" maxBufferSize="65536" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"/> </binding> </customBinding> Test client config file <customBinding> <binding name="DocumentRepository_Binding_Soap12"> <!--<reliableSession maxPendingChannels="4" maxRetryCount="8" ordered="true" />--> <!--<mtomMessageEncoding messageVersion ="Soap12WSAddressing10" ></mtomMessageEncoding>--> <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12WSAddressing10" writeEncoding="utf-8"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> </textMessageEncoding> <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" /> </binding> </customBinding> If I use the textMessageEncoding I am getting <soap:Text xml:lang="en">MustUnderstand headers: [{http://www.w3.org/2005/08/addressing}To, {http://www.w3.org/2005/08/addressing}Action] are not understood.</soap:Text> If I use mtomMessageEncoding I am getting The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error. My Router class is as follows: [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, AddressFilterMode = AddressFilterMode.Any, ValidateMustUnderstand = false)] public class EmployeeService : IEmployeeService { public System.ServiceModel.Channels.Message ProcessMessage(System.ServiceModel.Channels.Message requestMessage) { ChannelFactory<IEmployeeService> factory = new ChannelFactory<IEmployeeService>("client"); factory.Endpoint.Behaviors.Add(new MustUnderstandBehavior(false)); IEmployeeService proxy = factory.CreateChannel(); Message responseMessage = proxy.ProcessMessage(requestMessage); return responseMessage; } } The "client" in the above code under ChannelFactory is defined in the config file as: <client> <endpoint address="http://JavaWS/EmployeeService" binding="wsHttpBinding" bindingConfiguration="wsHttp" contract="EmployeeService.IEmployeeService" name="client" behaviorConfiguration="clientBehavior"> <headers> </headers> </endpoint> </client> Really appreciate your kind help. Thanks in advance, Raghu

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >