I'm somewhat new to web development, so I'm unsure of the terminology to use here. I have a wcf web service that I've build for windows azure. I would like to have multiple endpoints that resolve to the same service, however I'm not entirely sure how to configure this.
This may help explain what I'm wanting a little better:
Currently, I have a service at https://myapp.cloudapp.net/service.svc
I would like to have the following url point to the same service in the application:
https://myapp.cloudapp.net/myapp/service.svc
I'm sure this is something easy to do, I just haven't been able to find a solution yet.
Edit:
I found this documentation on MSDN:
http://msdn.microsoft.com/en-us/library/ms734786.aspx
However, I can't seem to get it to work.
Here is is how my endpoint is defined in my web.config:
<services>
<service behaviorConfiguration="MetadataEnabled" name="myProject.myApp.myService">
<host>
<baseAddresses>
<add baseAddress="https://localhost/myService/" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsBinding" name="wsBase" contract="myProj.myApp.IServ" />
<endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="mexBinding" name="HttpMetadata" contract="IMetadataExchange" />
<endpoint address="myApp/" binding="wsHttpBinding" bindingConfiguration="wsBinding" name="WsPlain" contract="myProj.myApp.IServ" />
</service>
</services>
It's still not working, but hopefully it's getting close. Would love any suggestions!
I just found out the answer. I just needed to create a folder in the project "myApp", and make copy the .svc file (not the .svc.cs file) to that folder. This allowed the following to work:
myapp.cloudapp.net/service.svc
myapp.cloudapp.net/myapp/service.svc
This is trivial and probably you already do, but are you defining InputEndpoints in ServiceDefinition.csdef?
There's a WCF Routing Service that might be of use (or might be overkill).
See also Supporting Multiple IIS Site Bindings and Endpoint Addresses.
Related
I'm replacing our old (VB.NET/asmx) service with WCF. We wanted to use WebAPI but have too many customers that still want SOAP. We'll be hosting in IIS 7. (.NET 4.5.2)
Each of our customers (~30) expects their own URL: https://www.example.com/API/4.0/ATT...whatever. I don't anticipate our customer count getting beyond 50 anytime soon.
I know I can accomplish this (as our old service did) by creating a .svc file for each client and (I believe) another endpoint in the config. But from what I've read I think this can be accomplished just through multiple endpoints for one service (the binding and contract/interface are all the same) and that seems much cleaner.
I've made a little progress on this but am running into problems. I'm not asking for help on those problems (yet!) - I'm asking: does anyone have input on whether this is a feasible (or the best?) approach before I dig farther?
Below is a snippet of the config file. I feel like I'm pretty close but if filtering/listenUri is wiser I'll switch tactics.
<service name="API" behaviorConfiguration="beUserNameBehavior">
<host>
<baseAddresses>
<add baseAddress="https://ww6.example.com/API"/>
<!--<add baseAddress="http://localhost:55375/"/>-->
</baseAddresses>
</host>
<endpoint name="BE" address="/BE" binding="wsHttpBinding" bindingConfiguration="beUserNameBinding" contract="API.IBEAPI" />
<endpoint name="SAP" address="/SAP" binding="wsHttpBinding" bindingConfiguration="beUserNameBinding" contract="API.IBEAPI" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
I have a wcf service (not self hosted).
When I deleted the section from web.config
<services>
<service name="Namespace.A">
<endpoint address="" binding="basicHttpBinding" name="A_EndpointBinding" contract="A" />
</service>
</services>
it works.
How could that be possible ? Does it occur any problem without that ?
If you can successfully connect and use the service (Namespace.A) using HTTP, then you should have nothing to worry about!
What's happening is either the above is misconfigured or its interfering with other settings and/or hard-coded functionality.
Trying to set up second web site in IIS 7, most/all of the mirrored services function except ones configured for net.tcp. Trying to access the .svc url, I receive the following error:
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
IIS binding configuration:
Advanced Settings:
Trying to follow answers found on Stack Overflow, none seem to work.
Content of the service's web.config:
<system.serviceModel>
<services>
<service name="ServiceName">
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration=""
name="basic" contract="ServiceName.IService" />
<endpoint address="nettcp" binding="netTcpBinding" bindingConfiguration=""
name="netTCP" contract="ServiceName.IService" />
<host>
<baseAddresses>
<add baseAddress="http://staging.localhost/ServiceName" />
<add baseAddress="net.tcp://localhost:8033/ServiceName" />
</baseAddresses>
</host>
</service>
</services>
Is there a trick to the net.tcp bindings? What is correct configuration needed in the web.config?
Thanks!
A screenshot is worth a 1,000 words sometimes. In IIS manager, right-click on the application "ServiceName" and select Manage Application->Advanced Settings. In the advanced settings dialog box, check to see if you've added net.tcp to the Enabled Protocols:
I have wcf service application which i host on IIS and runs very well.
now i need to transfer the services to windows azure where i host them into web role.
i am not sure but i have heard that there are different bindings for windows azure
example:
azure has different bindings equivalent to basicHttp,WebHttp.
can i know what exactly i need to do to achieve the same.
here is my current service configuration
<service behaviorConfiguration="mybehavior" name="***">
<endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding"
contract="*" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://127.0.0.1:81/Mobile.svc" />
</baseAddresses>
</host>
</service>
what change does this need
Thanks
You can achieve your goal with web.config transofmrations (and here). The issue with Azure is that there is no localhost, nor 127.0.0.1 there (well, there might be, but nothing is being routed to that local loop address). All you have to do is to change the baseAddress.
In order to change the baseAddress you may do any of the following:
use web.config transofmrations and in your web.Release.config put your azure domain name in the base address (http://yourapp.cloudapp.net/, or your custom domain if you are using one)
programatically bind the wcf service using the DIP of the role instance (check this and that questions for more information)
I am using CSLA.NET. It works realy nice with the wsHttpBinding. Now, I have my own Windows-Service and search the solution, that I can use this Windows-Service as the CSLA-Server and using nettcpbinding. Can someone give me a tip how to going on? Perhaps someone has a sample how I can do that.
Thank you!
Best Regards, Thomas
Basically, you need to do two things:
change your server-side configuration to include an endpoint with the netTcpBinding (this can be in addition to the existing wsHttpBinding endpoint - no problem)
add the netTcpBinding to your client's config file as well and selecting that endpoint when you connect
You should have something like this in your server side config:
<services>
<service name="YourService">
<endpoint name="something"
address=""
binding="wsHttpBinding"
contract="IYourService" />
</service>
</services>
Just add an endpoint for the netTcpBinding:
<services>
<service name="YourService">
<endpoint name="something"
address=""
binding="wsHttpBinding"
contract="IYourService" />
<endpoint name="something"
address="net.tcp://YourServer:7171/YourService"
binding="netTcpBinding"
contract="IYourService" />
</service>
</services>
Now if you're hosting in IIS, you might run into some problems - you need to configure IIS7 (Win2008 or Win2008R2 server), and in IIS6, you won't be able to host your netTcp service in IIS6 :-(
Same thing on the client side - add a second endpoint for netTcp:
<client>
<endpoint name="something"
address="http://YourServer/SomeVirtDir/YourServiceFile.svc"
binding="wsHttpBinding"
contract="IYourService" />
<endpoint name="netTcpEndpoint"
address="net.tcp://YourServer:7171/YourService"
binding="netTcpBinding"
contract="IYourService" />
</client>
and now when you create your endpoint in code, use the named endpoint:
YourServiceClient client = new YourServiceClient("netTcpEndpoint");
That should be all, really (unless CSLA requires something extra which I wouldn't know about.... I know "plain-vanilla" WCF)