Format:
Recent snippets matching tags of wcf
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);
50 Views
no comments
public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); LoadButton.Click += LoadButton_Click; SaveButton.Click += SaveButton_Click; }
108 Views
no comments
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");
259 Views
no comments
<%@ 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]
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">
65 Views
no comments
public class DbContextDomainService<TContext> : DomainService where TContext : DbContext, new() { private TContext _DbContext; protected TContext DbContext { get { return _DbContext ?? (_DbContext = CreateDbContext()); } }
141 Views
no comments
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;
232 Views
no comments
#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);
622 Views
no comments
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();
223 Views
no comments
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());
538 Views
7 comments
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="false" targetFramework="4.0" /> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> <system.serviceModel>
675 Views
no comments
[OperationContract] public Contact SaveContact(Contact entity) { bool _IsDeleted = false; string _EntitySetName; _EntitySetName = "Contacts"; using (CometEntities _Context = new CometEntities()) {
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
4208 Views
no comments
class Program { static void Main() { if (Environment.UserInteractive) { ServiceManager serviceManager = new ServiceManager(); serviceManager.OpenAll(); Console.ReadKey(); serviceManager.CloseAll(); } else ServiceBase.Run(new WindowsService());
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>
1107 Views
no comments
[TestClass] public class DateConversionTests { public DateConversionTests() { } [TestMethod] public void AjaxDate_IsoDate_DataContract_DeserializationTest()
955 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
