'Endpoint not found.' while consuming rest service of WCF through browser - asp.net

I have created WCF Rest service that take input/para from client and save it in database and knowledge with identity of table in which data is added.When I am consuming service throgh client that is nothing but web application making url as web request and getting proper output.But when I am consuming through browser getting error.
First I tried like this :-
http://localhost:Portnumber/Test.svc/ADD/Bodywash/Orange/50
after that like this
ht
tp://localhost:Portnumber/Test.svc/ADD?Name=Bodywash&CategoryName=Orange&Price=50
I am getting error'Entpoint not found'.How to consume rest service through browser?Will I able to do that
// Code of service
-- Table
CREATE TABLE [dbo].[Product](
[ProductId] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NULL,
[CategoryName] [varchar](50) NULL,
[Price] [int] NULL
)
-- Sp
ALTER procedure [dbo].[proc_InsertProduct]
(
#id int out,
#Name nvarchar(50),
#CategoryName nvarchar(50),
#Price int
)
as insert into Product
(
Name,
CategoryName,
Price
)
values
(
#Name,
#CategoryName,
#Price
)
set #id = ##identity
return #id
-- Interface
public interface ITest
{
[WebInvoke(UriTemplate = "ADD/{Name}/{CategoryName}/{Price}", Method = "POST", ResponseFormat = WebMessageFormat.Json)]
int InsertProduct(string Name, string CategoryName, string Price);
}
-- class
public class Test : ITest
{
public int InsertProduct(string Name, string CategoryName, string Price)
{
string constr = ConfigurationManager.ConnectionStrings["SampleConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("proc_InsertProduct", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.Parameters.AddWithValue("#Name", Name);
cmd.Parameters.AddWithValue("#CategoryName", CategoryName);
cmd.Parameters.AddWithValue("#Price", Price);
cmd.Parameters.Add("#id", SqlDbType.Int);
cmd.Parameters["#id"].Direction = ParameterDirection.Output;//Output parameter
cmd.ExecuteNonQuery();
con.Close();
int result = (int)(cmd.Parameters["#id"].Value);
return result;//returning id
}
}
// WebConfig
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<connectionStrings>
<add name="SampleConnectionString" connectionString="Data Source=xxx.xxx.x.x;Initial Catalog=sample;Persist Security Info=True;User ID=sa;Password=xxxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="RestApiTest.Test" behaviorConfiguration="serviceBehavior">
<endpoint address="" binding="webHttpBinding" contract="RestApiTest.ITest" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>

Continuation from comments - updating as answer due to size limit of comments
This would work though I wont recommend doing it - respecting the HTTP Verbs, all get request should be GET, add should be POST, update should be PUT (PATCH in case for patches) and delete should be DELETE methods. I would suggest you to revert this method back to POST.
Because client might be accessing it through browser - By this, I'm assuming that you mean to say that this service will be consumed from client side using JavaScript code. If that is true, then you dont have to worry about it. if someone POSTs data (for eg, using $.ajax or $.post in case of jQuery) to your REST service, you will get data properly.
To make this method a standard POST method, please change the method signature to accept a comples object instead of getting Name, CategoryName & Price from the route. Change this int InsertProduct(string Name, string CategoryName, string Price); to something like int InsertProduct(Product product); where 'Product' class has required properties. You can find a sample implementation here - POST complex object to WCF REST.

Related

PayPal RestApiSDK .NET http 503 Server Unavailable

I am trying to use the PayPal .NET RestApiSDK to store credit cards and take payments in their sandbox. I am using .NET 4.5 in an MVC project.
I followed the example code here:
https://developer.paypal.com/webapps/developer/docs/api/#store-a-credit-card
Initially, things were very easy. On day one, I was able to:
-take several payments
-store several cards
-look up sales
-refund sales
-store cards in the vault
(basically, everything in their example code)
Ever since day one (about a week), I have been getting an http 503 "Server Unavailable" error. Unless I changed something in my sleep, I am using the exact code that worked before.
I contacted PayPal support, and after several back and forth messages they have let me know that while they can't pinpoint an error in my code, the error must be on my side, because their servers are working fine.
What is really strange, is that I seem to be able to do anything that doesn't change data. For instance, I can call payments.List(). However, I can't call creditCard.Create() or payment.Create().
Also, the access token is being created just fine. The line tokenCredential.GetAccessToken() does not return any server error. When I debug the code, it has indeed returned with a proper token.
Question:
What could possibly be causing an http 503 error when I try to store a card or take a payment?
Here is some relevant code.
controller:
public JsonResult RunTestPayment()
{
string id = ConfigManager.Instance.GetProperties()["ClientID"];
string secret = ConfigManager.Instance.GetProperties()["ClientSecret"];
OAuthTokenCredential tokenCredential = new OAuthTokenCredential(id, secret);
string accessToken = tokenCredential.GetAccessToken();
PayPal.Api.Payments.Address billingAddress = new PayPal.Api.Payments.Address();
billingAddress.line1 = "52 N Main St";
billingAddress.city = "Johnstown";
billingAddress.country_code = "US";
billingAddress.postal_code = "43210";
billingAddress.state = "OH";
PayPal.Api.Payments.CreditCard creditCard = new PayPal.Api.Payments.CreditCard();
creditCard.number = "4417119669820331";
creditCard.type = "visa";
creditCard.expire_month = 11;
creditCard.expire_year = 2018;
creditCard.cvv2 = "874";
creditCard.first_name = "Joe";
creditCard.last_name = "Shopper";
creditCard.billing_address = billingAddress;
PayPal.Api.Payments.Details amountDetails = new PayPal.Api.Payments.Details();
amountDetails.subtotal = "7.51";
amountDetails.tax = "0.03";
amountDetails.shipping = "0.03";
PayPal.Api.Payments.Amount amount = new PayPal.Api.Payments.Amount();
amount.total = "7.56";
amount.currency = "USD";
amount.details = amountDetails;
PayPal.Api.Payments.Transaction transaction = new PayPal.Api.Payments.Transaction();
transaction.amount = amount;
transaction.description = "This is the payment transaction description.";
List<PayPal.Api.Payments.Transaction> transactions = new List<PayPal.Api.Payments.Transaction>();
transactions.Add(transaction);
PayPal.Api.Payments.FundingInstrument fundingInstrument = new PayPal.Api.Payments.FundingInstrument();
fundingInstrument.credit_card = creditCard;
List<PayPal.Api.Payments.FundingInstrument> fundingInstruments = new List<PayPal.Api.Payments.FundingInstrument>();
fundingInstruments.Add(fundingInstrument);
PayPal.Api.Payments.Payer payer = new PayPal.Api.Payments.Payer();
payer.funding_instruments = fundingInstruments;
payer.payment_method = "credit_card";
PayPal.Api.Payments.Payment payment = new PayPal.Api.Payments.Payment();
payment.intent = "sale";
payment.payer = payer;
payment.transactions = transactions;
PayPal.Api.Payments.Payment createdPayment = payment.Create(accessToken);
return Json(new JsonWrapper { Data = createdPayment });
}
When stepping through, the error occors on the line
PayPal.Api.Payments.Payment createdPayment = payment.Create(accessToken);
the exact error (as a Json Object):
"ClassName":"PayPal.Exception.PayPalException","Message":"Exception in HttpConnection Execute: Invalid HTTP response The remote server returned an error: (503) Server Unavailable.","Data":null,"InnerException":{"ClassName":"PayPal.Exception.ConnectionException","Message":"Invalid HTTP response The remote server returned an error: (503) Server Unavailable.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at PayPal.HttpConnection.Execute(String payLoad, HttpWebRequest httpRequest)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nExecute\nPayPalCoreSDK, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null\nPayPal.HttpConnection\nSystem.String Execute(System.String, System.Net.HttpWebRequest)","HResult":-2146233088,"Source":"PayPalCoreSDK","WatsonBuckets":null},"HelpURL":null,"StackTraceString":" at PayPal.PayPalResource.ConfigureAndExecute[T](Dictionary`2 config, IAPICallPreHandler apiCallPreHandler, HttpMethod httpMethod, String resourcePath)\r\n at PayPal.PayPalResource.ConfigureAndExecute[T](APIContext apiContext, HttpMethod httpMethod, String resource, String payload)\r\n at PayPal.Api.Payments.Payment.Create(APIContext apiContext)\r\n at PayPal.Api.Payments.Payment.Create(String accessToken)\r\n at Scout.Controllers.PaymentController.RequestPermissions() in e:\\Scout\\Scout\\Controllers\\PaymentController.cs:line 1105","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nConfigureAndExecute\nPayPalCoreSDK, Version=1.4.1.0, Culture=neutral, PublicKeyToken=null\nPayPal.PayPalResource\nT ConfigureAndExecute[T](System.Collections.Generic.Dictionary`2[System.String,System.String], PayPal.IAPICallPreHandler, PayPal.HttpMethod, System.String)","HResult":-2146233088,"Source":"PayPalCoreSDK","WatsonBuckets":null
web.config (api keys are truncated here):
...
<configuration>
<configSections>
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
...
</configSections>
...
<paypal>
<settings>
<add name="endpoint" value="https://api.sandbox.paypal.com"/>
<add name="ClientID" value="AbayoRB3Eq6YxM6"/>
<add name="ClientSecret" value="EDWNfxDxnGZ3hWZW"/>
<add name="connectionTimeout" value="360000"/>
<!-- The number of times a request must be retried if the API endpoint is unresponsive -->
<add name="requestRetries" value="3"/>
</settings>
</paypal>
...
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="ScoutPaypalLog.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="FileAppender" />
</root>
</log4net>
As you can see, I have configured log4net, and it is recording data generated by another .dll I'm using (for RavenDB), but there are no entries made by PayPal.
Thanks!
I finally uninstalled the two nuget packages RestApiSDK and PayPalCoreSDK. I then restarted Visual Studio. Finally, I re-installed those same two packages.
Without changing any code, it started working.

Windows Workflow 4 with custom instance store not working

I created a simple workflow service with custom instance store(to support oracle).
The custom instance store, i follow the demo from MSDN: [http://msdn.microsoft.com/en-us/library/ee829481.aspx][1]
But when i invoke the service api, raise the exception:
A value of the wrong type was retrieved from the instance store. A
value of type {/Default Web Site/}OrderService.svc was expected, but
null was encountered instead.
I try to use SqlWorkflowInstanceStore, it's OK. No problem for service.
I use custom instance store again and debug, i found LoadWorkflowCommand be executed before SaveWorkflowCommand. I think it's an issue. Need your help!
The following is my code snippet:
1. Web Config:
<extensions>
<behaviorExtensions>
<add name="databaseWorkflowInstanceStore" type="Practices.Framework.Workflow.Configuration.DatabaseInstanceStoreElement, Practices.Framework" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior>
<!--<sqlWorkflowInstanceStore connectionStringName="practicesDatabase" instanceCompletionAction="DeleteAll" instanceEncodingOption="GZip" />-->
<databaseWorkflowInstanceStore database="practicesDatabase" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
2. DatabaseInstanceStore
public class DatabaseInstanceStore : InstanceStore
{
protected override IAsyncResult BeginTryCommand(InstancePersistenceContext context, InstancePersistenceCommand command, TimeSpan timeout, AsyncCallback callback, object state)
{
if (command is CreateWorkflowOwnerCommand)
{
var instanceOwnerId = Guid.NewGuid();
context.BindInstanceOwner(instanceOwnerId, instanceOwnerId);
}
else if (command is LoadWorkflowCommand)
{
var instanceData = this.LoadInstanceData();
context.LoadedInstance(InstanceState.Initialized, instanceData, null, null, null);
}
else if (command is SaveWorkflowCommand)
{
var saveCommand = (SaveWorkflowCommand)command;
var instanceData = saveCommand.InstanceData;
this.SaveInstanceData(instanceData);
}
return new CompletedAsyncResult<bool>(true, callback, state);
}
......
}
The MSDN article only shows the bare minimum of commands you need to implement. It sounds like you need to support more command so I would check which commands are dispatched that you don't support yet. See here for a list of commands.
The BeginTryCommand is called with the following commands executed in this order:
1. CreateWorkflowOwnerCommand
2. LoadWorkflowCommand
3. SaveWorkflowCommand
4. SaveWorkflowCommand
So for LoadWorkflowCommand:
I need Create Instance before Load
http://social.msdn.microsoft.com/Forums/en/dublin/thread/e51d7b18-1e27-4335-8ad0-4ce76b9f8b91

WCF Service and AspNetCompatibilityEnabled="true" causing Request Error

I have a WCF Service defined as:
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class Service
{
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public string HelloWorld()
{
return "Hello World";
}
}
My Web.Config file:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true"/>
</webHttpBinding>
</bindings>
<services>
<service name="Service">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="Service" behaviorConfiguration="webHttpBehavior"/>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
</configuration>
I want to be able to access ASP .Net session variables in my WCF service, and I want the WCF service to be returning JSONP data, however even with this simple service, browsing to ../Service.svc/HelloWorld I am getting a 400 Bad Request error.
Can someone point me in the right direction?
Looks like the combination of JSONP, ASP.NET Compatibility and an authenticated user is not supported per this Microsoft forum.
According to the moderator of the forum, you need to disable one of the three.
Probably not the answer you were hoping for, but the moderator's explanation is pretty good and offers a few suggestions.
Hope this helps. Good luck!
I realise this has already been answered, but it's possible (though I'm unsure if recommended from a security perspective) to 'de-authenticate' a request early enough to pass the check being made by the webHttpBinding.
The gist is to set HttpContext.Current.User to be a new GenericPrincipal built on a GenericIdentity with no name or type mimicking what you'd see if an unauthenticated user had just hit your service - by the time the webHttpBinding performs its 'no authenticated JSONP calls' check the request is taking place in the context of an unauthenticated user.
Note: I'm unsure if there are security implications of this - one off the top of my head is that if you have an authenticated user their session state will still be available to your service which may be a bad thing, depending on what you're doing.
You can do this in a couple of places
By hooking the Application.AuthenticateRequest event, filtering by request URL
With a custom WCF message inspector
Example message inspector and behavior element (same class, very much use at own risk):
using System;
using System.Security.Principal;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Threading;
using System.Web;
namespace MyNamespace
{
public class ForceAnonymousEndpointBehavior : BehaviorExtensionElement, IDispatchMessageInspector, IEndpointBehavior
{
public override Type BehaviorType
{
get { return typeof(ForceAnonymousEndpointBehavior); }
}
protected override object CreateBehavior()
{
return new ForceAnonymousEndpointBehavior();
}
object IDispatchMessageInspector.AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
HttpContext.Current.User = Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("", ""), null);
return null;
}
void IDispatchMessageInspector.BeforeSendReply(ref Message reply, object correlationState)
{
}
void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new ForceAnonymousEndpointBehavior());
}
void IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
{
}
void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
}
void IEndpointBehavior.Validate(ServiceEndpoint endpoint)
{
}
}
}
Then in web.config register the behavior extension (in the system.serviceModel element):
<extensions>
<behaviorExtensions>
<add name="ForceAnonymous" type="MyNamespace.ForceAnonymousEndpointBehavior, MyAssembly" />
</behaviorExtensions>
</extensions>
Adding the behavior to the endpointBehavior in question (again under system.serviceModel):
<behaviors>
<endpointBehaviors>
<behavior name="jsonpBehavior">
<ForceAnonymous />
</behavior>
</endpointBehaviors>
</behaviors>
...and making sure the endpoint behavior is called out in your service's endpoint declaration by setting the behaviorConfiguration attribute to match the behavior name you used above.

AJAX Enabled WCF Service fails if Date Property is DateTime.MinValue

If a AJAX-Enabled WCF should return an Object with a Date Property which is Nothing a Request to this Service fails.
Test.svc
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
Imports System.Runtime.Serialization
<ServiceContract(Namespace:="WebApp")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class Test
<OperationContract()>
<WebGet()>
Public Function TestOperation() As CompositeType
Dim obj As New CompositeType
obj.DateProp = Nothing
obj.StringProp = "Test"
Return obj
End Function
End Class
<DataContract()>
Public Class CompositeType
<DataMember()>
Public Property DateProp() As Date
<DataMember()>
Public Property StringProp() As String
End Class
scripttag on Testform.aspx
<script type="text/javascript">
$(document).ready(function () {
$.getJSON('./Test.svc/TestOperation', function (data) {
alert(data.d.DateProp);
});
});
</script>
Web.config (serviceModel section)
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WebApp.TestAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="WebApp.Test">
<endpoint address="" behaviorConfiguration="WebApp.TestAspNetAjaxBehavior"
binding="webHttpBinding" contract="WebApp.Test" />
</service>
</services>
</system.serviceModel>
Chrome displays on this call the following error message: "failed to load resource".
Has anyone an explanation/idea for this behaviour and how are you supposed to prevent this problem?
Thanks for your advice ;)
If you want to be able to assign Nothing to a DateTime field you should make it nullable:
<DataMember()>
Public Property DateProp() As Nullable(Of DateTime)
I am not a VB.NET expert but as far as I know the Date keyword in VB.NET is an alias to the DateTime structure (which is not nullable), except that VB.NET must be doing some black voodoo magic to allow you to assign Nothing to it. Except that when the serializer attempts to serialize it into JSON the following exception is thrown:
There was an error while trying to serialize parameter
WebApp:TestOperationResult. The InnerException message was 'DateTime
values that are greater than DateTime.MaxValue or smaller than
DateTime.MinValue when converted to UTC cannot be serialized to
JSON.'. Please see InnerException for more details.

Trying to get REST service running on ASP.NET

I have created a REST server under ASP.NET and I can't figure out the url to bring up the service. I am running under VS 2010 using it's built in web server. I believe it is actually running (VS 2010 starts up fine). But every combination I can think of for a url doesn't bring it up.
Update: Please take a look at the file http://www.windward.net/temp/RestUnderAspDotNet.zip - I have two solutions in there. The one at src\update runs fine as a REST server. I have pretty much the same code at inetpub\wwwroot\update and while it runs, I can't find a url that talks to it. I tried every variation of http://localhost:56469/update/App_Code/RestServiceImpl.svc/test I could think of and get either 403 or 404.
Any idea why? (I do not want any security on this - anyone will be able to hit it once it's up.)
App_Code\IRestServiceImpl.cs:
[ServiceContract]
public interface IRestServiceImpl
{
[OperationContract]
[WebInvoke(UriTemplate = "/version", Method = "POST")]
XmlElement GetVersion(XmlElement stats);
[OperationContract]
[WebInvoke(UriTemplate = "/test", Method = "GET")]
string GetTest();
}
App_Code\RestServiceImpl.svc:
<%# ServiceHost Language="C#" Debug="true" Service="RestServiceImpl" CodeBehind="RestServiceImpl.svc.cs" %>
App_Code\RestServiceImpl.cs:
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Xml;
[AspNetCompatibilityRequirements
(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class RestServiceImpl : IRestServiceImpl
{
public XmlElement GetVersion(XmlElement stats)
{
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("update");
root.SetAttribute("version", "11.0.13.0");
doc.AppendChild(root);
return doc.DocumentElement;
}
public string GetTest()
{
return "update server is running";
}
}
Relevant part of web.config:
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="RestServiceImpl">
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="webHttpBinding" contract="IRestServiceImpl" behaviorConfiguration="webBinding">
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="RestServiceImpl">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webBinding">
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Any idea what the url is to bring up the /test GET?
thanks - dave
You can try something like:
http://localhost:whateverportVSgivesyou/RestServiceImpl.svc/test
If the VS webserver is running you should see a system tray icon for it, and if you hover over it you'll see the port it's running on...
I finally figured this out. I have this also on my blog at Windward Wrocks with screenshots. Here's the solution w/o screenshots:
Install the WCF REST Service Template 40(CS) (requires .NET 4.0).
Create a WCF service. This is a New “Project…” not a “Web Site…”. And it is under the general “Visual C#” templates, not “WCF”!

Resources