CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of wcf
C#
public class AuthOperationHandler : HttpOperationHandler<HttpRequestMessage, HttpRequestMessage>
{
    public AuthOperationHandler() : base("response")
    {
    }
 
    protected override HttpRequestMessage OnHandle(HttpRequestMessage request)
    {
        var credentials = ExtractCredentials(request.Headers.Authorization);
        var authenticated = IsAuthenticated(credentials);
by Antony Scott   January 16, 2012 @ 1:07pm
50 Views
no comments
 
C#
public partial class MainPage : PhoneApplicationPage
{
    // Constructor
    public MainPage()
    {
        InitializeComponent();
        LoadButton.Click += LoadButton_Click;
        SaveButton.Click += SaveButton_Click;
    }
by Jerry Nixon   November 22, 2011 @ 7:04pm
Tags: WP, WCF
108 Views
no comments
 
C#
class Program
{
    static void Main()
    {
        // I have an application in my IIS Site called "ZeroConfig", where the service from http://codepaste.net/s5hwyv is running
        HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://localhost/ZeroConfig/Service.svc/HelloWorld/test/helloworld");
        req.Method = "POST";
        req.ContentType = "text/plain";
        Stream reqStream = req.GetRequestStream();
        byte[] fileToSend = Encoding.UTF8.GetBytes("sometext");
by Carlos Figueira   October 10, 2011 @ 9:57pm
Tags: WCF, Rest
259 Views
no comments
 
C#
<%@ ServiceHost Language="C#" Debug="true" Service="Service"
                Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
 
using System;
using System.IO;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
 
[ServiceContract]
by Carlos Figueira   October 10, 2011 @ 9:55pm
Tags: WCF, Rest
344 Views
no comments
 
<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="True"/>
    <services>
      <service behaviorConfiguration="SyndicationServerBehavior" name="SimpleBolg.services.FeedService">
        <endpoint behaviorConfiguration="AjaxBehavior" binding="webHttpBinding" contract="SimpleBolg.services.IFeedService"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SyndicationServerBehavior">
by frank2tek   October 04, 2011 @ 11:20am
65 Views
no comments
 
C#
public class DbContextDomainService<TContext> : DomainService where TContext : DbContext, new()
{
  private TContext _DbContext;
  protected TContext DbContext
  {
    get
    {              
      return _DbContext ?? (_DbContext = CreateDbContext());
    }
  }
by Shimmy Weitzhandler   May 27, 2011 @ 3:28am
141 Views
no comments
 
C#
public partial class Entities
{
 
  public void Insert<T>(T entity) where T : class
  {
    if (entity == null) throw new ArgumentNullException("entity");
 
    // Note: changing the state to Added on a detached entity is the same as calling
    // Add on the DbSet.                    
    Entry(entity).State = EntityState.Added;
by Shimmy Weitzhandler   May 27, 2011 @ 3:24am
232 Views
no comments
 
C#
#region Get entity set name             
public string GetEntitySetName(Type entityType)
{
  if (entityType == null)
    throw new ArgumentNullException("entityType");
 
  if (!entityType.IsSubclassOf(typeof(EntityObject)))
    throw new ArgumentException("Only subclasses of EntityObject are supported.", "entityType");
 
  return GetEntitySetNameInternal(entityType);
by Shimmy Weitzhandler   May 18, 2011 @ 8:13pm
622 Views
no comments
 
C#
CallbackType cb = new CallbackType();
InstanceContext context = new InstanceContext(cb);
 
//WSDualHttpBinding binding = new WSDualHttpBinding();
//binding.ClientBaseAddress=new Uri("http://localhost:8100");
NetTcpBinding binding = new NetTcpBinding();
 
var factory = new DuplexChannelFactory<IHelloIndigoService>(context, binding, new EndpointAddress("net.tcp://localhost:9000/tcp"));
IHelloIndigoService proxy = factory.CreateChannel();
by bnaya   December 06, 2010 @ 5:20am
Tags: WCF, Duplex
223 Views
no comments
 
C#
public class Global : System.Web.HttpApplication
{
    protected void Application_Start(object sender, EventArgs e)
    {
        var builder = new ContainerBuilder();
        builder.RegisterType<ContactResource>();
        builder.RegisterType<ContactsResource>();
        builder.RegisterType<ContactRepository>().As<IContactRepository>();
 
        var configuration = new ContactManagerConfiguration(builder.Build());
by Glenn Block   November 10, 2010 @ 7:39am
Tags: WCF
538 Views
7 comments
 
XML
<?xml version="1.0"?>
<configuration>
 
  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
by tonyv   September 18, 2010 @ 11:06pm
Tags: JsonP, WCF, .NET4
675 Views
no comments
 
C#
[OperationContract]
public Contact SaveContact(Contact entity)
{
    bool _IsDeleted = false;
 
    string _EntitySetName;
    _EntitySetName = "Contacts";
 
    using (CometEntities _Context = new CometEntities())
    {
by Jerry Nixon   June 30, 2010 @ 10:33pm
Tags: EF4, WCF, CRUD
1271 Views
1 comments
 
/// <reference path="jquery.js" />
/*
ServiceProxy.js  
Version 0.981 - 4/5/11
 
(c) 2008-2011 Rick Strahl, West Wind Technologies 
www.west-wind.com
 
Load json2.js before this library
http://github.com/douglascrockford/JSON-js/blob/master/json2.js
by Rick Strahl   April 12, 2010 @ 6:40pm
Tags: JSON, Ajax, Date, ASMX, WCF
4208 Views
no comments
 
C#
class Program {  
    static void Main() {  
        if (Environment.UserInteractive) {  
            ServiceManager serviceManager = new ServiceManager();  
            serviceManager.OpenAll();  
            Console.ReadKey();  
            serviceManager.CloseAll();  
        }  
        else  
            ServiceBase.Run(new WindowsService());  
by grenade   December 21, 2009 @ 5:54am
321 Views
no comments
 
if (JSON && !JSON.parseWithDate) {
    var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/;
    var reMsAjax = /^\/Date\((d|-|.*)\)[\/|\\]$/;
 
    JSON.parseWithDate = function(json) {
        /// <summary>
        /// parses a JSON string and turns ISO or MSAJAX date strings
        /// into native JS date objects
        /// </summary>    
        /// <param name="json" type="var">json with dates to parse</param>        
by Rick Strahl   September 15, 2009 @ 3:31pm
1107 Views
no comments
 
C#
[TestClass]
public class DateConversionTests
{
    public DateConversionTests()
    {
    }        
 
 
    [TestMethod]
    public void AjaxDate_IsoDate_DataContract_DeserializationTest()
by Rick Strahl   September 15, 2009 @ 12:46pm
955 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate