Incorrect address when service is hosted in Azure - wcf

I have hosted a WCF service on Azure at http://voraservice.cloudapp.net/MyPushService.svc. The problem is when I connect through client, it gives me that no endpoint found at the given address:
http://rd00155d3425e0/MyPushService.svc
I dont know how this random servername came here and am trying to figure out since few hours how to remove this random server name and put the actual location of the WCF hosted on the cloud. Any pointers to solutions are appretiated!
Update: I saw this KB article - http://support.microsoft.com/kb/971842/
But when I try to update for Win7 its says hte update is not for my computer.

Initially I was redirected to this KB - http://support.microsoft.com/kb/971842/ but this dint help me on my Windows 7 machine.
Finally I was able to resolve this by adding useRequestHeadersForMetadataAddress tag inside serviceBehaviors tag.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ShoutboxWebRole.ShoutsBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<useRequestHeadersForMetadataAddress/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
...
</services>
</system.serviceModel>

May sound like a manual instruction, but please check the config of consuming application. Often it is pointing to wrong direction. Here is a similar problem discussed in this blog post http://junooni.wordpress.com/tag/azure-incorrect-address-no-endpoint-listening/
All the best.

Related

Metadata exposed but WSDL not found

I am having trouble with my WCF service which somehow fails to expose/publish a WSDL definition. I have already gone through the MSDN tutorial on exporting Metadata. Also have I searched at least for some hours but the majority of people have different/simpler problems than me.
I am pretty sure my config file is correct so I would be thankful for anybody who could suggest other places I can look for?
My service is generally running and I can access it on localhost, where I get the standard page for the WCF services (message displaying "To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:" etc.).
When I try to access the *?wsdl extension my browser tells me that the page couldn't be found.
When I try to test the service in soapUI it tells me that there is something wrong with the WSDL.
So, I hope this gives anybody an idea of what my problem is and I would be really thankful for any help.
Cheers
Have you specified httpGetEnabled in your serviceBehavior?
<behaviors>
<serviceBehaviors>
<behavior name="SubscriberOperationsBehavior">
<serviceMetadata httpGetEnabled="true"
httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
You can also create a mex endpoint.
Add the following endpoint to your service configuration:
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />

Configuring a WCF service (Web.config) - HttpsGetEnabled, HttpsGetUrl

I am trying to deploy a Silverlight with WCF Service to a hosting. Basically, I have the same problem as this guy:
How to configure WCF services to work through HTTPS without HTTP binding?
Except the solutions don't work for me.
//edit: I've been pasting it wrong, but it still doesn't work.
I have tried Ladislav Mrnka's answer - changed this in the Web.config file:
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
The dreaded error still appears when I navigate to the .svc file on the server:
The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the
HttpsGetUrl property is a relative address, but there is no https base address.
Either supply an https base address or set HttpsGetUrl to an absolute address.
Now it should be all correct, I just changed the httpGetEnabled and
httpsGetEnabled in the proper place (it's already in the config file).
But I still get the error. Should I perhaps specify the HttpsGetUrl
somewhere? Where?
Yes, see here.
Should be:
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceMetadata httpsGetEnabled="true"
httpsGetUrl="https://myComputerName/myEndpoint" />
</behavior>
</serviceBehaviors>
</behaviors>
This error happened because the setting is logically wrong. If you enable the httpsGetEnabled means, you allow clients to retrieve metadata via https. And if you don't provide a URL about https, how can clients retrieve metadata from https. So the error message alert you to provide a URL.
Either supply an https base address or set HttpsGetUrl to an absolute address.
You have three options.
Provide httpsGetUrl as other answers showed above
Binding an address via IIS
(if you are still developing in visual studio then you only need to degug with SSL Enabled mode )
Set httpsGetEnabled to false
In configuration, under behaviour where you have set httpsGetEnabled="true",
Set httpsGetUrl="https://UserSystemName/EndPointName" too and problem resolved.
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpsGetEnabled="true" httpsGetUrl="https:///UserSystemName/EndPointName"/>
</behavior>
</serviceBehaviors>
</behaviors>

WCF: method that returns void causes "The server did not provide a meaningful reply" error on client

I'm getting the following error on the client when I have aspNetCompatibilityEnabled="true" and a service method that returns void. Adding a non-void return value to the method makes the error go away. Turning off aspnet compatibility also makes the problem go away.
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
My website's web config contains the following:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Does anyone have any thoughts on why this might be happening? If not, does anyone know of ways to turn on additional logging or tracing that might be able to help? How can I tell if it is a "premature session shutdown"?
The server side code does execute without error. This problem happens somewhere between the service method completing and the response arriving back at the client.
Please do not suggest turning off aspnet compatibility as the solution. I need to the able to access HttpContext.Current within my services for various reasons.
You can enable tracing by following this link.
Also can you post your service class skeleton and the config entry related to it along with the client code where you are trying to invoke the service. This would help to identify the problem more easily.

Problem with WCF Hosting on Mono

I am trying to host a simple application with one .aspx, .asmx and .svc file each. I followed the below guide to achieve the hosting (since I am very new to the linux world, it took a while to understand it!):
http://www.mono-project.com/Mod_mono#Manual_Mod_Mono_Configuration
After all the hosting, I am able to access the aspx and asmx file. But when I try to access the svc file, I get the below error:
The ServiceHost must have at least one application endpoint (that does not include metadata exchange endpoint) defined by either configuration, behaviors or call to AddServiceEndpoint methods.
or
HttpListenerContext does not match any of the registered channels
I do have a pretty straight forward service endpoint defined in my web.config which looks like below:
<system.serviceModel>
<services>
<service name="TestWCFService">
<endpoint address="http://localhost/MonoTest/TestWCFService.svc" binding="basicHttpBinding"
contract="MonoTest.ITestWCFService"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Can you please tell me what I am doing wrong?
Note: I used MS VS 2010 to create this project and then published it. The published directory is copied to the Apache/Linux Environment. The WCF doesn't make use of any complex type. I am using Mono Version 2.8.2
UPDATE
Update: I tried using 2.10.2 Mono. This error is gone and I am now facing a new one:
XmlSchema error: Named item http://tempuri.org/:DoWork was already contained in the schema object table. Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation. Related schema item SourceUri: , Line 0, Position 0.
After weeks of R&D on this I have figured out this. For some reason, I can't get the service WSDL to work (meaning I can't access the .svc from browser). However, the service works fine when I try to access it using Channel Factory.
So I have implemented everything in Channel Factory (for my Silverlight app) and everything seems to be working fine right now. I am still not sure how to get WSDL to work but that's not too important to me as of now.

Is it bad to have 'You have created a service' page for published wcf service on the internet?

I have created wcf service and planning to make it accessible from the internet. The page 'You have created a service' seems to be some stub which should be replaced before putting service on production. Is it a bad practice to have this welcome page on production? What do you do with that welcome page when you publish wcf services on the internet?
Thanks
On production you can turn off this page by adding:
<behaviors>
<serviceBehaviors>
<behavior name="ProductionService">
<serviceDebug includeExceptionsInDetail="false" httpHelpPageEnabled="false" />
</behavior>
<serviceBehaviors>
</behavirs>
Also think about publishing WSDL / Metadata. If you don't want to publish WSDL but you want to use mex endpoint use following configuration:
<behaviors>
<serviceBehaviors>
<behavior name="ProductionService">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionsInDetail="false" httpHelpPageEnabled="false" />
</behavior>
<serviceBehaviors>
</behavirs>
Your services must use those behavior in their behaviorConfiguration attribute.
Yes, it's bad. It says potential attackers that the system is non-configured completely, so they would try to attack it. Also, it's not very professional.
Well, print something useful there or hide it:-)