On my dev box I have a solution with 6 projects. It is a WCF(3 proj) and multiple biz projects (other 3).
When I copy the core WCF folder, it's bin and web.config I get an error message on the server saying that it cannot find the contract that is stated in the app.config section of the biz app with an app.config.
Where should I put this app.config? I tried to add the node to the web config but no go there.
If you're trying to host that services into a web application, you'll need to merge manually that individual app.config files (one for each WCF project) into your web.config file, under <system.serviceModel> section.
EDIT: You'll need something like this into your host configuration (web project?)
<system.serviceModel>
<services>
<service name="YourCompany.YourProject.YourService"
behaviorConfiguration="YourBehaviorConfiguration">
<endpoint address=""
binding="wsHttpContextBinding"
contract="YourCompany.YourProject.IYourService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="YourBehaviorConfiguration">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Related
I have WCF service that works fine on VS2008's Development Server, but after I deployed it on IIS 5.1 and ran the following error message comes up:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
The appropriate section in web.config file looks as following:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="Parus.ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="Parus.ServiceBehavior" name="Parus.Service">
<endpoint address="" binding="basicHttpBinding" contract="Parus.IService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
I've tried to follow this article:
http://blogs.msdn.com/b/rampo/archive/2008/02/11/how-can-wcf-support-multiple-iis-binding-specified-per-site.aspx
But it's not working.
Does anybody know to resolve this issue?
Goran
<system.serviceModel>
<services>
<service
name="myClass.IService1" behaviorConfiguration="myService">
<endpoint
name="ep1"
address="http://localhost:57582/Service1.svc"
contract="IService1"
binding="basicHttpBinding"
/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myService">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
but still i am getting the following error::
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
your service name IService1 - this looks like it might in fact be
the contract. If you are using the normal templates then remove the
I from IService1
If you are IIS hosting you can remove the address as the location of the .svc file is automatically the address.
The contract needs to be fully qualified including the namespace of the contract interface
with this in place your metadata should be served from <.svc file location>?wsdl
I am trying to create a WCF web service which will allow other applications to retrieve a string by making a http request to this service url. I tried publishing the service in IIS and when attempting to browse to it, using the url, it says it
' The resource cannot be found'
when I checked the path to the folder I used the url,
and I get the error
'No protocol binding matches the given address
'http://localhost:xxxx/WcfSampleLibrary/Service1/mex.'
Protocol bindings are configured at the Site level in IIS or WAS configuration'
Here is the directory path of the published folder:
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\WcfSampleLibrary.Service1
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\Web.config
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\bin\WcfSampleLibrary.dll
The web config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfSampleLibrary.Service1" behaviorConfiguration ="mex">
<host>
<baseAddresses>
<add baseAddress = "http://192.xxx.x.xxx/WcfSampleLibrary/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint address =""
binding="wsHttpBinding" contract="WcfSampleLibrary.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<endpoint address="http://localhost:xxxx/WcfSampleLibrary/Service1/mex" name="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mex">
<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="true" />
</behavior>
</serviceBehaviors>
</behaviors>
In IIS-hosted WCF services you don't specify a full URI in the address. IIS decides the address. Also the baseAddresses element is completely ignored when hosting in IIS (so remove it from you Web.config). The service's base address is determined by the web site & virtual directory into which your wcf service is placed.Do something like this:
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"
/>
Then your address would be http://IIS.SERVER/SiteName/Folder/WcfSampleLibrary.Service1.svc. If you're not sure what the address is, use your IIS Administration tool, select the site that has the service in it, Right-click and choose Advanced -> Browse Site.
Also, I'd turn on httpGetEnabled on your mex behavior--if you want to publish your WSDL. This makes it easier to consume your service as you are developing it:
<behaviors>
<serviceBehaviors>
<behavior name="mex" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
With httpGetEnabled being on, browsing to your service URI will give you an option to see the WSDL.
I host simple WCF service in IIS in web application.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="SimpleServiceBehavior" name="SimpleService">
<endpoint address="" binding="basicHttpBinding" contract="ISimpleService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
When I run service hosted on http://projects.mydomain.com/application/SimpleService.svc it shows default service page with link to WSDL:
svcutil.exe http://terminal.mydomain.local/application/SimpleService.svc?wsdl and so on
Clients can create service reference but fail to execute methods because cannot resolve host name terminal.mydomain.local
The question is why server name is its local name 'terminal.mydomain.local' instead of 'projects.mydomain.com' ?
I found answer: http://forums.asp.net/p/1096811/1659596.aspx
I needed to change host headers.
I'm generating WCF service using Biztalk. The code I get is this:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviorConfiguration">
<serviceDebug httpHelpPageEnabled="true" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="false" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" externalMetadataLocation="" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<!-- Note: the service name must match the configuration name for the service implementation. -->
<service name="Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkServiceInstance" behaviorConfiguration="ServiceBehaviorConfiguration">
<endpoint name="HttpMexEndpoint" address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<!--<endpoint name="HttpsMexEndpoint" address="mex" binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />-->
</service>
</services>
</system.serviceModel>
Maybe it's not the most beautifull configuration, but it works. The problem is I don't know how to modify timeouts and message max size, because it has only mex endpoint. I'm surprised how this works at all with just mex endpoint.
So two questions are:
Why does this works at all?
What should I add to extend timeouts and message size?
I seem to recall the reason those settings aren't in the config file is because the binding configuration is stored in the receive location / send port settings in biztalk itself. So the way to set them is to change them from the receive location adapter configuration.