I asked this before and got no where so i'm asking again as i'm now desperate!!
Hey
if i create a new wcf project i can browse the meta instantly.
if I try - when using the WCF facility - i get the following:
Metadata publishing for this service is currently disabled.
i followed the instructions there and in a million other places and get no where.
if i copy the contents of my faciltity service into the newly created project it complains that aspNetCompatibilityEnabled isnt enabled.
so i enable it and then mex is disabled again and i get: Metadata publishing for this service is currently disabled.
again!!
this is driving me crazy - i have tried tried tried to follow every example on the web!!
here is my current configuration - there is no client yet:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="IbzStar.WebServices.UserServices" behaviorConfiguration="ServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" contract="IbzStar.WebServices.IUserServices">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</behaviors>
</system.serviceModel>
please someone help me out before my laptop gets launched into orbit!!
w://
Yes, you need to make sure that service name, interface and config definitions are defined correctly. check for mis-match in names etc. Better to define configuration from scratch rather than identifying mistakes.
Related
I've been battling with this one for weeks in my spare-time, determined not to turn to this wonderful community. But my spirit is broken. So ...
I have created a WCF Service and am trying to host it in a Console App, with a view to using a TCP end point.
I have one project which contains the contract and the svc file.
I have another project which contains a Console app, which references the first-mentioned project.
The main method of my Console app looks like this:
using (ServiceHost host = new ServiceHost(typeof(LicenceBucketWireService.LicenceBucketService)))
{
host.Open();
foreach (var endpt in host.Description.Endpoints)
{
Console.WriteLine("Enpoint address:\t{0}",endpt.Address);
Console.WriteLine("Enpoint binding:\t{0}",endpt.Binding);
Console.WriteLine("Enpoint contract:\t{0}\n", endpt.Contract.ContractType.Name);
}
Console.ReadLine();
}
Up til this point, all is dandy:
It goes awry when I try to add a Service Reference for that service to a 3rd completely separate app which is going to consume that service. When I try to add a reference, using net.tcp://localhost:49189/LicenceBucketWireService/LicenceBucketService/mex as the address for discovering details, I get an error:
The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:49189/LicenceBucketWireService/LicenceBucketService/mex'.
Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:49189/LicenceBucketWireService/LicenceBucketService/mex'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
The console app is running when I perform this task.
The app config has the following element:
<system.serviceModel>
<services>
<service name="LicenceBucketWireService.LicenceBucketService">
<clear />
<endpoint address="mex" binding="mexTcpBinding" contract="LicenceBucketWireService.ILicenceBucketService"
listenUriMode="Explicit">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="net.pipe://localhost/licenceBucketService"
binding="netNamedPipeBinding" bindingConfiguration="" contract="LicenceBucketWireService.ILicenceBucketService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:49187/LicenceBucketWireService/LicenceBucketService" />
<add baseAddress="net.tcp://localhost:49189/LicenceBucketWireService/LicenceBucketService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="false" />
<!-- 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>
</behaviors>
</system.serviceModel>
The following line of code in the config file:
<endpoint address="mex" binding="mexTcpBinding" contract="LicenceBucketWireService.ILicenceBucketService"
listenUriMode="Explicit">
should have the contract as "IMetadataExchange" instead of LicenceBucketWireService.ILicenceBucketService.
That should take care of the problem.
I want to run WCF Service from my VS2010 When i run WCF Service using below configuration.
<system.serviceModel>
<services>
<service name="WcfSample.Service1" behaviorConfiguration="servicebehaviour1">
<endpoint address ="http://localhost:8080/service1/Service1.svc" contract="WcfSample.IService1" binding="wsHttpBinding"></endpoint>
<endpoint address="" binding="mexHttpBinding" contract ="IMetadataExchange"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="servicebehaviour1">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="false"/>
<!-- 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>
</behaviors>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />-->
i am getting exception as below
No protocol binding matches the given address 'http://localhost:8080/service1/Service1.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
If i want to run my WCF at my given address wat should i do.
Hosting of WCF service doesnt take the address you define in endpoints of config file
<endpoint
address="http://localhost:8080/service1/Service1.svce"
So the above one you defiend is not correct one instead of this you need to do as below
you address of service is the web server and the virtual directory plus the SVC file name like as below
http://servername/vrirualdirectoryname/svcfiename.svc/
you can define relative addresses like as below :
<service name="WcfSample.Service1">
<endpoint name=""
address="ServiceAddress"
binding="wsHttpBinding"
contract="WcfSample.IService1" />
</service>
so finally you service adress from which you consume service is
http://servername/vrirualdirectoryname/svcfiename.svc/ServiceAddress
so like this you can do rather than specifying address direcly.
Note :
Above code is asuinming that service is going to be hosted on IIS server.
I currently have a wcf service library project that includes my service contract & implementation. If I were to go to a web project within the same solution and add a service reference and click on the discover button, I can see my service listed as http://..design_time_address/myservice listed.
Now if i were to go ahead and move my service contract & implementation classes to another project & configure my wcf library project to point to this new project, I'm finding that when i go and try to discover the service within my web application, I'm not seeing the design_time_address anymore. It's not discovering anything..
Here's what my app.config for the wcf service looked like before I moved the classes to a new project
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="Test.Server.Wcf.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8732/Design_Time_Addresses/Test.Server.Wcf/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="wsHttpBinding" contract="Test.Server.Wcf.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</behaviors>
</system.serviceModel>
</configuration>
and here's what it looks like after the move
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="Test.Server.Core.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8732/Design_Time_Addresses/Test.Server.Wcf/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="wsHttpBinding" contract="Test.Server.Core.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</behaviors>
</system.serviceModel>
</configuration>
What am I doing incorrectly? Any help would be greatly appreciated. I've been stuck on this for hours now and I feel like I'm losing my mind...
Thanks
The Discover option you use to add a service reference is an internal visual studio function. What is does is start and list the WCF services it can actually find an implementation for. For some reason it wants to find the implementation of the service interface in a WCF project type (library or application) with a config file. So if you moved you implementation to the Core project being a regular class library without app.config file, it will not Discover your service anymore.
What you can do is start your service manually and browser to the URL to add a service reference. It is just the discovery option that does not work anymore.
I am totally new to this and trying to host the simplest WCF service with a net.tcp binding
I have Windows 7 Professional and IIS7 and have enabled NON http activation.
I start a new WCF Service application
project in vs2010 and compile it.
NOHTING ELSE!
I delete all my IIS
Websites and add a new called WCFHost
I open up WcfTestClient.exe and adds
http://localhost/Service1.svc the application finds it
The Web.config looks like this (untouched)
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
<endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService2.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</behaviors>
</system.serviceModel>
So far, so good. But what about that net.tcp binding. I add the "enabledProtocols" attribute so my applicationHost.config looks like this
<site name="WCFHOST" id="3">
<application path="/" applicationPool="WCFHOST" enabledProtocols="http,net.tcp,net.pipe,net.msmq">
<virtualDirectory path="/" physicalPath="C:\Prosjekter\temp\TestService\TestService" />
</application>
<bindings>
<binding protocol="net.tcp" bindingInformation="808:*" />
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
Then I go to the IIS WCFHost website and add binding net.tcp 808:*
And then I modify my web.config for the WCF Service to look like this. (just changed the binding on the endpoints)
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="netTcpBinding" contract="WcfService2.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService2.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</behaviors>
</system.serviceModel>
When I now try to add the service net.tcp://localhost:808/Service1.svc in my WcfTestClient.exe I get the error
Error: Cannot obtain Metadata from net.tcp://localhost/Service1.svc
TCP-errorcode 10061: No connection could be made because the target machine actively refused it.... 127.0.0.1:808
My firewall is turned off.
I have seen one thing, though.. when using netstat -a the 808 port is not listed there.. should it?
Can someone help me just creating my first WCF service with nettcp binding?
As Tocco says, check that the service is running. You can do this by checking:
netstat /an | find /i "808 "
And it should show:
TCP 0.0.0.0:808 0.0.0.0:0 LISTENING
TCP [::]:808 [::]:0 LISTENING
if the service is running correctly.
To get it to start if it's not already working, you can issue:
sc start NetTcpActivator
from the command line to ttry to start it.
Even before that, make sure that the non-HTTP activation windows components are installed.
Also check that the services are actually running. I had a problem where they would not necessarily start after a reboot.
The net.tcp bindings are enabled on IIS for requests on 808?
Check it on IIS manager / bindings.
See it
I had the same error message and resolved it by not only creating a TCP binding on the site as follows:
But also enabling the net.tcp protocol in Advanced Settings:
I want to use netTCPbinding, so I've changed my web config as below. I'm experiencing this error:
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
How can this be solved?
<services>
<service name="DXDirectory.DXDirectoryService" behaviorConfiguration="DXDirectory.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="netTcpBinding" bindingConfiguration="WindowsSecured" contract="DXDirectory.IDXDirectoryService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:2582/DXDirectoryService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DXDirectory.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="false" />
<!-- 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" />
<serviceAuthorization principalPermissionMode="UseWindowsGroups" />
<!--<serviceCredentials>-->
<!--<userNameAuthentication userNamePasswordValidationMode="Custom"
membershipProviderName="CustomUserNameValidator"/>-->
<!--</serviceCredentials>-->
</behavior>
</serviceBehaviors>
</behaviors>
HMm... you've added the base address to your services/host section ok.
Quick question: are you self-hosting, or hosting in IIS ?? Which version of IIS ??
IIS5/6 only support HTTP connections - you cannot host a NetTCP in IIS 5/6.
In IIS7, you have to manually go through a series of steps to enable non-HTTP bindings, but it's possible. See this MSDN article on how to achieve this.
Self-hosting is the best option - you get all bindings and are in total control of your service being hosted.
Marc
Here is a NetTcpBinding basic example from msdn. See if this can help you.
EDIT:
And here is a related SO question.
I cant see section in your config file, can u please
please add this
<netTcpBinding>
<binding name="WindowsSecured">
<security mode="none"/>
</binding>
</netTcpBinding>