0

I'm trying to get my device working with my WCF service hosted in Azure, so I followed the article Connected Devices Using the .NET Micro Framework that shows me how to do it.

The point at which I'm having problems is when I'm trying to run MFSvcUtil.exe to generate the proxy code, so I can access the WCF service methods from NETMF at device side.

If I try to run

C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools\MFSvcUtil.exe" http://myservice.cloudapp.net/TrackingService.svc?singlewsdl /V

I get this output:

**MfSvcUtil.exe (c) Microsoft 2008
Reading WSDL file: http://myservice.cloudapp.net/TrackingService.svc?singlewsdl
Could not find schema information for the element 'HTML'.
Severity: Warning
Exception: System.Xml.Schema.XmlSchemaValidationException: Could not find schema information for the element 'HTML'.
SourceUri: http://myservice.cloudapp.net/TrackingService.svc?singlewsdl
LineNumber: 1
Position: 2
StackTrace: 

Program Error: The WSDL file is not compatible.**

Now, if I try to run with the regular WSDL file like

MFSvcUtil.exe" http://myservice.cloudapp.net/TrackingService.svc?WSDL /V

I get this output followed by a StackOverflowException that I can't find the stacktrace, see http://localhostr.com/file/QCEVawT/log.txt (uploaded because of the limit of characters).

And this is my full WSDL: http://pastebin.com/M9KVYD0e

How do I work around this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gutemberg Ribeiro
  • 1,533
  • 1
  • 21
  • 45

1 Answers1

1

I would like to know whether you are using .NET 4.5. The singlewsdl option is a new feature in .NET 4.5, but by default, Windows Azure doesn’t have .NET 4.5 installed (yet). If you want to use .NET 4, please use ?wsdl instead of ?singlewsdl.

In addition, please also make sure you have the useRequestHeadersForMetadataAddress behavior, otherwise WSDL may not work as expected. You can check FIX: URIs in a WCF WSDL document refer to inaccessible internal instances instead of to the load balancer as expected in the .NET Framework 3.0 in Windows Server 2003, Windows XP, Windows Vista and Windows Server 2008 for more information. It is not needed to install the hotfix, though, as this feature has already been built-into .NET 4.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ming Xu - MSFT
  • 2,116
  • 1
  • 11
  • 13
  • Thanks for the reply Ming. The point is that I'm using .net 4 on VS2010. Also, the singleWSDL works on .net 4 if u are running on localhost here but when I deploy to azure only WSDL work. – Gutemberg Ribeiro Apr 19 '12 at 13:04
  • Singlewsdl is a new feature in .NET 4.5. You can refer to http://msdn.microsoft.com/en-us/library/dd456789(v=vs.110).aspx for more information. Or do you mean you're using a third party framework to generate the WSDL file? By default, WCF 4 supports the ?wsdl option. – Ming Xu - MSFT Apr 19 '12 at 13:10
  • Ming, its weird so, but anyway. I give up the WCF+.Net Micro Framework. – Gutemberg Ribeiro Apr 19 '12 at 18:43
  • I'm now using the WCF Rest. Everything seems fine. Except that even if I'm using the attribute: `[WebGet(UriTemplate = "/Devices/{customerId}" + WebFormat.JSON, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]` The request requires that parameter `?format=json` must be informed in URL, otherwise the Endpoint is not found. It is working, the problem is that even if I set to requires json at the request/response, it keeps returning a damn XML with the data. What I'm missing? – Gutemberg Ribeiro Apr 19 '12 at 18:44
  • Please do not put + WebFormat.JSON in UriTemplate. You can let WCF automatically configure the response format. Then according to the Accept header from the client, WCF will automatically return JSON or XML. Please refer to http://msdn.microsoft.com/en-us/library/ee476510.aspx for more information. – Ming Xu - MSFT Apr 20 '12 at 07:19