I've stripped down the service code to the bare minimum that I can and still having issues and wonder if anyone else can take a look.
I have gotten the server code in "Getting Started with the Internet of Things" appendex working, but really want to write WCF services. I had some trouble earlier till I opened up my port (8080) to allow the netduino to run properly with that code.
Setup, netduino plus plugged into the network switch, also plugged into USB on my development computer.
I feel I must be making some really basic mistake. Thanks for any assistance,
Cris
Netduino code:
namespace WCFTest { using System.Net; public class Program { public static void Main() { HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://172.16.0.15:8080/Service1.svc/GetData/1"); myReq.Method = "GET"; HttpWebResponse WebResp = (HttpWebResponse)myReq.GetResponse(); } } }WCF Service Code:
IService1.cs
namespace NetduinoWCF { using System.ServiceModel; using System.ServiceModel.Web; [ServiceContract] public interface IService1 { [WebGet(UriTemplate = "GetData/{value}")] [OperationContract] string GetData(string value); } }Service1.svc.cs
namespace NetduinoWCF { public class Service1 : IService1 { public string GetData(string value) { return "0"; } } }Web.config
<?xml version="1.0"?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5"/> </system.web> <system.serviceModel> <services> <service name="NetduinoWCF.Service1" behaviorConfiguration="ServiceBehavior"> <endpoint address="" binding="webHttpBinding" contract="NetduinoWCF.IService1" behaviorConfiguration="web"></endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ServiceBehavior"> <!-- To avoid disclosing metadata information, set the values below to false before deployment --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <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>
Edited by Chris Walker, 09 December 2012 - 10:18 PM.
added [code][/code] tags