Web service URL gets a strange URL
-
mercoledì 22 agosto 2012 19:26
I have built a web service which reads an azure sql database...when i deploy my package to windows azure I get strange URL for the web service as shown below.
http://splobservice.cloudapp.net/SharePointCallingService.svc
svcutil.exe http://rd00155d3aa3d3/SharePointCallingService.svc?wsdl
Where is the "rd00155d3aa3d3" coming from surely it should be the main url?
I have tried setting the endpoint address to blank and to the following
address="splobservice.cloudapp.net"
But each time i get this random number...can anyone explain this?
It almost looks like a staging ID?!
TIA
S
Tutte le risposte
-
mercoledì 22 agosto 2012 20:44
Hi StephenMD,
What you are seeing is the Azure instance internal name. There is a hotfix for this to older .net framework versions - you just need to enable it, no need to install it (most likely). I recommend you reading it.
Anyways, you should be able to resolve this by modifying your web.config like this:
To enable the hotfix after you installed it, you have to configure the WCF service to use the following service behavior:<serviceBehaviors> <behavior name="<name>"> <useRequestHeadersForMetadataAddress> <defaultPorts> <add scheme="http" port="81" /> <add scheme="https" port="444" /> </defaultPorts> </useRequestHeadersForMetadataAddress> </behavior> </serviceBehaviors>
Note: <name> is a placeholder that you should replace with the behavior name in your WCF service.
The hotfix causes WCF to generate the correct URI by using the "Host" HTTP header of the incoming metadata request. In this case, the "Host" header contains the load balancer address instead of the internal node address.
If a URI inside the WSDL document has a different scheme than the scheme of the "Host" header URI, for example, if a request for metadata comes over HTTPS but the metadata contains HTTP URIs, the hotfix will need the port number for that different scheme. The port number can be specified per scheme in the <defaultPorts> section.Hope this helps!
Best Regards,
Carlos Sardo
- Modificato Carlos Sardo mercoledì 22 agosto 2012 20:44
- Proposto come risposta Carlos Sardo mercoledì 22 agosto 2012 20:44
- Modificato Carlos Sardo mercoledì 22 agosto 2012 20:55
-
mercoledì 22 agosto 2012 21:51
Thanks for the reply, When you say older.net framework version do you mean older than 3.5? I am using 3.5 currently on this project. Would it be worth changing the .Net version to 4.0?
S
-
giovedì 23 agosto 2012 07:27
Thanks for the reply, When you say older.net framework version do you mean older than 3.5? I am using 3.5 currently on this project. Would it be worth changing the .Net version to 4.0?
S
Hi,
In the article it is described that:
APPLIES TO
- Microsoft .NET Framework 3.0
- Microsoft .NET Framework 3.0 Service Pack 1
- Microsoft .NET Framework 3.0 Service Pack 2
But, just to be sure... please change it to 4.0 in your end and give it another try.
Best Regards,
Carlos Sardo -
giovedì 23 agosto 2012 08:32
Hey Carlos...kept it at 3.5 and applied the hotfix changes, it runs locally but when i deply to azure i get the following error.
http://splobservice.cloudapp.net/SharePointCallingService.svc
Parser Error Message: Invalid element in configuration. The extension name 'useRequestHeadersForMetadataAddress' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.
I'll try the .Net 4 version now..
Thanks again for your input.
Stephen
- Modificato StephenMD giovedì 23 agosto 2012 08:32
-
giovedì 23 agosto 2012 08:59
Hi Stephen,
Just open it in my Browser and it seems to be OK. Didn't see any error and the URL is also OK. Did you already changed it for .NET 4.0?
Best Regards,
Carlos Sardo
- Modificato Carlos Sardo giovedì 23 agosto 2012 09:03
- Modificato Carlos Sardo giovedì 23 agosto 2012 09:03
-
giovedì 23 agosto 2012 09:35
Ha! yes I have already changed it...everything seems to be working now that I'm using .net 4.0.
Thanks for all you input.
Stephen
-
giovedì 23 agosto 2012 10:03
Spoke to soon, for soon reason my targetNamespace is all wrong...
http://splobservice.cloudapp.net/SharePointCallingService.svc?wsdl
Its showing up as http://tempuri.org/??
S
-
giovedì 23 agosto 2012 10:18
Spoke to soon, for soon reason my targetNamespace is all wrong...
http://splobservice.cloudapp.net/SharePointCallingService.svc?wsdl
Its showing up as http://tempuri.org/??
S
Does this stops you from successfully consuming your web service?
If you really need to get rid of it, you can follow this simple tutorial.
Hope this helps!
Best Regards,
Carlos Sardo- Proposto come risposta Carlos Sardo giovedì 23 agosto 2012 10:18
-
giovedì 23 agosto 2012 11:32
Wow i cannot believe the issues I am running into here...
Pretty sure I need to run this as 3.5 as I'm consuming the web service in Sharepoint on-line which runs on 3.0/3.5.
When i try the site compiled as 3.5 i get an error on the ports i added to fix the other issue.
http://splobservice.cloudapp.net/SharePointCallingService.svc
Invalid element in configuration. The extension name 'useRequestHeadersForMetadataAddress' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.
Strange!
S

