This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
jQuery pub/sub plugin by Peter Higgins ([email protected]) | |
Loosely based on Dojo publish/subscribe API, limited in scope. Rewritten blindly. | |
Original is (c) Dojo Foundation 2004-2010. Released under either AFL or new BSD, see: | |
http://dojofoundation.org/license for more information. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_BeginRequest(object sender, EventArgs e) | |
{ | |
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:53738"); | |
if (HttpContext.Current.Request.HttpMethod != "OPTIONS") return; | |
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST, PUT, DELETE"); | |
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept"); | |
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000"); | |
HttpContext.Current.Response.End(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: "http://localhost:53920/MyServiceSample.svc/jsonp/DoSomeWork?request=" + | |
JSON.stringify({ Param1: 1, Param2: "bla"}) + | |
"&callback=?", | |
contentType: "application/json", | |
dataType: "json", | |
type: "GET", | |
success: function(data) { | |
if (data.success) { | |
// do some stuff... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bindings> | |
<webHttpBinding> | |
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" /> | |
</webHttpBinding> | |
</bindings> | |
<!-- JSONP Endpoints --> | |
<endpoint address="jsonp" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" | |
behaviorConfiguration="jsonBehavior" contract="MyServiceLibrary.IMyServiceSample" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: "http://localhost:53920/MyServiceSample.svc/json/DoSomeWork?request=" + | |
JSON.stringify({ Param1: 1, Param2: "bla"}) | |
contentType: "application/json", | |
dataType: "json", | |
type: "GET", | |
success: function(data) { | |
if (data.success) { | |
// do some stuff... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var service = WcfDynamicSoapProxy<IMyServiceSample>.CreateProxy("http://localhost:53920/MyServiceSample.svc/soap")) | |
{ | |
var response = service.Channel.DoSomeWork(new SomeWorkRequest(new { Param1=1, Param2="bla“})); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WcfDynamicSoapProxy<T> : IDisposable where T : class | |
{ | |
public static WcfDynamicSoapProxy<T> CreateProxy(string endpointAdressUri) | |
{ | |
return new WcfDynamicSoapProxy<T>(endpointAdressUri); | |
} | |
protected readonly ChannelFactory<T> DynamicChannelFactory; | |
public T Channel { get; private set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
For more information on how to configure your ASP.NET application, please visit | |
http://go.microsoft.com/fwlink/?LinkId=169433 | |
--> | |
<configuration> | |
<!-- | |
For a description of web.config changes for .NET 4.5 see http://go.microsoft.com/fwlink/?LinkId=235367. | |
The following attributes can be set on the <httpRuntime> tag. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : System.Web.HttpApplication | |
{ | |
protected void Application_Start(object sender, EventArgs e) | |
{ | |
Log.Info("Application_Start"); | |
} | |
protected void Application_Error(object sender, EventArgs e) | |
{ | |
var error = Server.GetLastError(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ ServiceHost Language="C#" Debug="true" Service="MyServiceLibrary.MyServiceSample" %> |