Why WCF service is not getting called in AJAX auto complete extender? - c#

I am trying to consume a wcf service in auto complete extender but it is not getting called but the same thing i tried in web services it's working fine there.
Below is my sample code
In App_Code/AutoCompleteWCF.cs
[ServiceContract]
public interface IAutoCompleteWCF
{
[OperationContract]
[System.ServiceModel.Web.WebInvoke(Method = "POST",ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json)]
string[] GetCompletionList(string prefixText, int count );
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class AutoCompleteWCF : IAutoCompleteWCF
{
[OperationContract]
[System.ServiceModel.Web.WebInvoke(Method = "POST", ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json)]
public string[] GetCompletionList(string prefixText, int count)
{
string[] str = new string[5];
str[0] = prefixText + "A";
str[1] = prefixText + "B";
str[2] = prefixText + "C";
str[3] = prefixText + "D";
str[4] = prefixText + "E";
return str;
}
}
AutoCompleteWCF.svc
<%# ServiceHost Language="C#"Debug="true" Service="AutoCompleteWCF" CodeBehind="~/App_Code/AutoCompleteWCF.cs" %>
Web.confifg
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ServiceAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="AutoComplete" behaviorConfiguration="ServiceBehavior">
<endpoint address="F" binding="webHttpBinding" contract="IAutoCompleteWCF" behaviorConfiguration="ServiceAspNetAjaxBehavior">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
</configuration>
WebForm1.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AutoCompleteDemo.WebForm1" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ccl" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ccl:ToolkitScriptManager ID="ScriptManager1" runat="server"></ccl:ToolkitScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ccl:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
BehaviorID="AutoCompleteEx"
TargetControlID="TextBox1"
ServicePath="AutoCompleteWCF.svc"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="false">
</ccl:AutoCompleteExtender>
</div>
</form>
</body>
</html>

Related

Client Side Code Using WCF

Service.cs
public class StoredProcService : IStoredProcService
{
public int addData(int x, int y)
{
return x + y;
}
}
Error:415 Cannot process the message because the content type
'application/json; charset=utf-8' was not the expected type
'text/xml'aspx
<script type="text/javascript">
$(document).ready(function () {
//$('input[id^="button"]').click(function () {
// alert('You have clicked ' + $(this).val());
Add();
})
function Add() {
alert("sds");
$.ajax({
type: 'POST',
url: '/StoredProcService.svc/addData',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: {"x":"5", "y":"8"},
success: function (data) {
alert(data);
}
});
}
</script>
Markup:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Server Code" onclick="Button1_Click" />
<input id="button" type="button" value="Client Side" onclick="Add()" />
</div>
</form>
</body>
</html>
Interface:
[ServiceContract]
public interface IStoredProcService
{
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest,
UriTemplate = "addData")]
int addData(int x, int y);
}
WebConfig:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<appSettings>`
<add key="vs:EnableBrowserLink" value="false"/>
<add key="erpConnectionString" value="Data Source=mssql.aksharasoftware.com,1437;Initial Catalog=erp;uid=erp;password=100_erp;Pooling=true;Connection Lifetime=0;Min Pool Size=2;Max Pool Size=400;Connection Timeout=1200;"/>
<add key="PINEDITLICENSEKEY" value="141607143E07144807141606144804144762143E05142A06135162"/>
<add key="owin:AutomaticAppStartup" value="false"/>
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" />
<binding name="BasicHttpBinding_ISamplereturn" />
<binding name="BasicHttpBinding_IStoredProcService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50192/Service.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService"
contract="ServiceReference1.IService"
name="BasicHttpBinding_IService" />
<endpoint address="http://localhost:50192/Samplereturn.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ISamplereturn"
contract="ServiceReference2.ISamplereturn"
name="BasicHttpBinding_ISamplereturn" />
<endpoint address="http://localhost:50192/StoredProcService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IStoredProcService"
contract="ServiceReference3.IStoredProcService"
name="BasicHttpBinding_IStoredProcService" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" >
<serviceActivations>
<add factory="System.ServiceModel.Activation.WebServiceHostFactory"
relativeAddress="./ServiceReference3/StoredProcService.svc"
service="StoredProcService"/>
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
</configuration>
By default all the WCF communication occurs using XML.
Try to correct your javascript:
function Add() {
alert("sds");
$.ajax({
type: 'POST',
url: '/StoredProcService.svc/addData',
contentType: 'text/xml; charset=utf-8',
dataType: 'xml',
data: {"x":"5", "y":"8"},
success: function (data) {
alert(data);
}
});
Change the content type in ajax call to contentType: 'text/xml; charset=utf-8' it should work fine.
If you are getting error 400 then try to access URL from browser and correct the URL.

400 Bad request - REST JSON c#

I've created a C# WCF project, when I'm testing it using POSTMAN or Fiddler. I've received an error: "400 Bad Request". Also I've created an C# windows project to test, it is the same result as well. Here's my WCF Project.
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "api/createpr.json")]
PRApplication AddPR(RequestData rData);
}
I'm using this code when testing.
try
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://localhost/WEB_Service_B1/Service1.svc/api/createpr.json");
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"Test\"}";
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
Is there any problem also in my Web.config?
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="WS_B1.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WS_B1.Service1" behaviorConfiguration="WS_B1.Service1Behavior">
<endpoint address="" binding="webHttpBinding" contract="WS_B1.IService1" behaviorConfiguration="web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
</configuration>
BodyStyle = WebMessageBodyStyle.Wrapped
This means the request needs to be a full json object. Try with the following request body:
string json = "{\"rData\": {\"PropertyName\": \"Test\"}}";
Where PropertyName is a public property of RequestData class of string type.

WCF service relative uri without .svc

I have a solution with 3 projects:
MEProject.WCF.ServiceLayer (Service-Implementation)
MEProject.WCF.HostConsole (Console Application which can host the service)
MEProject.WCF.HostIIS (WCF Service Application)
My goal is that I can switch between the 2 projects without changing the uri (the endpoint configurations) in the client project. Well, the problem is, if I start the console application, the endpoints are
http://localhost:8080/MultipleEndpointService/FirstEndpoint
http://localhost:8080/MultipleEndpointService/SecondEndpoint
But if I start the WCF service application, the endpoints are
http://localhost:8080/MultipleEndpointService.svc/FirstEndpoint
http://localhost:8080/MultipleEndpointService.svc/SecondEndpoint
As you can see, the difference is the ".svc". Now my question: How can I tell the WCF service application to act like the console application and not to have the ".svc" in the uri?
Here is the code I use to get the multiple endpoints in the console application:
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
serviceHostBase.ChannelDispatchers.ToList().ForEach(channelDispatcher =>
{
ChannelDispatcher dispatcher = channelDispatcher as ChannelDispatcher;
if (dispatcher != null)
{
dispatcher.Endpoints.ToList().ForEach(endpoint =>
{
endpoint.DispatchRuntime.InstanceProvider = new CallBackInstanceProvider(serviceDescription.ServiceType, InstanceCreator);
});
}
});
}
And here is the WCF service application web.config:
<system.serviceModel>
<services>
<service name="MEProject.Service.WCF.HostIIS.MultipleEndpointService">
<endpoint name="FirstEndpoint" address="FirstEndpoint" binding="basicHttpBinding" contract="MEProject.Service.WCF.ServiceLayer.IFirstEndpoint"/>
<endpoint name="SecondEndpoint" address="SecondEndpoint" binding="basicHttpBinding" contract="MEProject.Service.WCF.ServiceLayer.ISecondEndpoint"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MultipleEndpointService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Thanks in advance for your response!
for running a WCF without the SVC extension you will need to use routing
for example i have a service named MultipleEndpointService.svc and i want to get the service like the following:
.../MultipleEndpointService/FirstEndpoint
we can do it like this:
Global.asax:
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new ServiceRoute("MultipleEndpointService/FirstEndpoint", new ServiceHostFactory(), typeof(MultipleEndpointService)));
}
}
MultipleEndpointService.svc.cs:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MultipleEndpointService : IMultipleEndpointService
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
Web.config (for IIS7):
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd"/>
</handlers>
<directoryBrowse enabled="true"/>
</system.webServer>
source
Try URL ReWriting :
<system.webServer>
<!-- Other stuff here -->
<rewrite>
<rules>
<!-- Rewrite requests to /MultipleEndpointService.svc to /MultipleEndpointService -->
<rule name="MultipleEndpointService" stopProcessing="true">
<match url="MultipleEndpointService.svc(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/MultipleEndpointService{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>

Web Service WCF and Javascript

I have 2 projects (WCF project and Asp.Net project). I followed this tutorial here .
In this tutorial, we realize all in one project (see sources here).
I have a reference to my WCF project in Web project.
I try to display a value in my alert but there is nothing.
Here is my Service1.svc :
namespace WSSage100{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string GetData2(int value)
{
return string.Format("You entered: {0}", value);
}
public string[] GetUser(string Id)
{
return new User().GetUser(Convert.ToInt32(Id));
}
public string GetTEST()
{
return "OKKKKKKKK";
}
}
Here is IService1.cs :
namespace WSSage100
{
[XmlSerializerFormat]
[ServiceContract(Namespace ="WSSage100")]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "GET",ResponseFormat = WebMessageFormat.Json)]
string GetData(int value);
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json)]
string GetData2(int value);
[OperationContract]
[WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped,ResponseFormat = WebMessageFormat.Json)]
string[] GetUser(string Id);
[OperationContract]
[WebInvoke(Method = "GET",ResponseFormat = WebMessageFormat.Json)]
string GetTEST();
Here is my web page (aspx) with JavaScript code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript" src="JavaScript/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
var Type;
var Url;
var Data;
var ContentType;
var DataType;
var ProcessData;
function WCFJSON() {
var userid = "1";
Type = "POST";
Url = "Service1.svc/GetUser";
Data = '{"Id": "' + userid + '"}';
ContentType = "application/json; charset=utf-8";
DataType = "json"; varProcessData = true;
CallService();
}
function CallService() {
$.ajax({
type: Type, //GET or POST or PUT or DELETE verb
url: Url, // Location of the service
data: Data, //Data sent to server
contentType: ContentType, // content type sent to server
dataType: DataType, //Expected data format from server
processdata: ProcessData, //True or False
success: function (msg) {//On Successfull service call
ServiceSucceeded(msg);
},
error: ServiceFailed// When Service call fails
});
}
function ServiceFailed(result) {
alert('Service call failed: ' + result.status + '' + result.statusText);
Type = null;
varUrl = null;
Data = null;
ContentType = null;
DataType = null;
ProcessData = null;
}
function ServiceSucceeded(result) {
if (DataType == "json") {
resultObject = result.GetUserResult;
for (i = 0; i < resultObject.length; i++) {
alert(resultObject[i]);
}
}
}
function ServiceFailed(xhr) {
alert(xhr.responseText);
if (xhr.responseText) {
var err = xhr.responseText;
if (err)
error(err);
else
error({ Message: "Unknown server error." })
}
return;
}
$(document).ready(
function () {
WCFJSON();
}
);
</script>
<style type="text/css">
#form1 {
height: 255px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div></div>
</form>
</body>
</html>
Here is Service1.svc in my Web project :
<%# ServiceHost Language="C#" Debug="true" Service="WSSage100.Service1"%>
Here is my web.config in my Web project :
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<client>
<endpoint address="http://localhost:52768/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="WebServiceSage100.IService1"
name="BasicHttpBinding_IService1" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
</basicHttpBinding>
</bindings>
<services>
<service name="WSSage100.Service1">
<endpoint address="" binding="webHttpBinding" contract="WSSage100.IService1">
</endpoint>
</service>
</services>
</system.serviceModel>
</configuration>
Brian, localhost:52768/Service1.svc display
I have this error when I use Inspect Element
I'm new in this domain and sorry for my bad english.
I had 2 projects in my solution, the WCF and an application console (GettingStartedHost) that will do to turn back the web service.
I also added the connectionstrings in app.config of the GettingStartedHost project and now it works well.

Calling a local WCF service via Scriptish or Greasemonkey

I'm trying to expose a local WCF service that checks to see if a file exists in my database that can be accessed from a Scriptish script.
Is it possible to call a local URL from Scriptish or Greasemonkey (GET or POST)? I've created a WCF service hosted in IIS on my local machine, and the service is working fine. However, when I try to call the service from Scriptish the Network tab in Chrome/Firefox just says the following:
Request URL: http://localhost/service/service.svc/MatchPartial
Request Method: OPTIONS
Status code: 405 Method Not Allowed
Here is my ajax call:
$.ajax({
url: 'http://localhost/service/service.svc/MatchPartial',
type: 'POST',
contentType: 'application/json; charset=UTF-8',
dataType: 'json',
processData: true,
data: '{ "partialFilename": "testing" }',
success: function (result) {
console.log(result);
}
});
My method is decorated with:
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public int MatchPartial(string partialFilename)
{
...
}
I have the following above my service class:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
I've tried adding the following to my service with no luck:
[WebInvoke(Method = "OPTIONS", UriTemplate = "*")]
public void GetOptions()
{
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Headers", "Content-Type");
}
I feel like I've tried everything. Any help would be appreciated!
I figured out how to do it via a GET request thanks to M.Babcock for pushing me in that direction (unimportant parts intentionally left out to save space).
Service.svc:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service : IService
{
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public bool MatchPartial(string partialFilename)
{
...
}
}
Web.config:
<configuration>
...
...
<system.web>
<compilation debug="true"
targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<!-- IMPORTANT FOR THIS TO WORK USING JQUERY GET OR AJAX -->
<add name="Access-Control-Allow-Origin"
value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
<system.serviceModel>
<services>
<service name="MyNamespace.Services.WCF.Service">
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration=""
contract="MyNamespace.Core.Interfaces.IService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Service" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<!-- For Debugging --->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Here's how to do it in Scriptish:
var service = "http://localhost/service/service.svc";
GM_xmlhttpRequest({
method: "GET",
url: service + "/MatchPartial?partialFilename=" + filename,
headers: { "Accept": "application/json" },
onload: function (result) {
if (result != null && result.status == 200 && result.responseJSON == true) {
videoFrame.remove();
}
},
onerror: function (res) {
GM_log("Error!");
}
});
Plain ol' jQuery:
$.get("service", { partialFilename: filename }, function (result) {
if (result == true) {
videoFrame.remove();
}
});

Categories