Metadata publishing for this service is currently disabled.
If you have access to the service, you can enable metadata publishing by completing the following steps to modify your web or application configuration file:
1. Create the following service behavior configuration, or add the <serviceMetadata> element to an existing service behavior configuration:
Note: your service must have an http base address to add this endpoint.
The following is an example service configuration file with metadata publishing enabled:
<configuration> <system.serviceModel> <services> <!-- Note: the service name must match the configuration name for the service implementation. --> <service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" > <!-- Add the following endpoint. --> <!-- Note: your service must have an http base address to add this endpoint. --> <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MyServiceTypeBehaviors" > <!-- Add the following element to your service behavior configuration. --> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>
If you disable metadata publish for this service, no wsdl file can describe this service, you cannot add service reference to this WCF service or you cannot use svcutil.exe to generate client proxy class and config file, so client cannot call your WCF service,
as the page described, you need to set httpGetEnabled to true.
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFCalcIISSVC.CustomUserNameValidator, WCFCalcIISSVC" />
</serviceCredentials>
<!-- 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>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
see the above app config file, you are using message as security mode for wsHttpBinding, and in the <serviceCredentials> element to specify userNameAuthentication, but you have not applied wsHttpBinding in the endpoint. you can try deleting the following
code from app.config.
It seems that if you host in IIS, specifying a base address is moot, since IIS will dictate where your service lives, you need to ensure that name of the <service> element is the same as the actual implementation service. Here is a article maybe you can
refer.
SudhaRubini
Member
391 Points
383 Posts
wcf service hosted in iis 7
May 15, 2012 12:44 PM|LINK
Hi,
i created wcf service in console application. i hosted in iis 7 in this post as like
http://blah.winsmarts.com/2008-4-Host_a_WCF_Service_in_IIS_7_-and-amp;_Windows_2008_-_The_right_way.aspx
i run my service i got following out put. In this out put correct or not?
-----------------------------------------------------------------------------------------------
This is a Windows© Communication Foundation service.
Metadata publishing for this service is currently disabled.
If you have access to the service, you can enable metadata publishing by completing the following steps to modify your web or application configuration file:
1. Create the following service behavior configuration, or add the <serviceMetadata> element to an existing service behavior configuration:
2. Add the behavior configuration to the service:
<service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" >Note: the service name must match the configuration name for the service implementation.
3. Add the following endpoint to your service configuration:
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />Note: your service must have an http base address to add this endpoint.
The following is an example service configuration file with metadata publishing enabled:
-------------------------------------------------------------------------------------------------------------------------------------------------------------please clarify my doubt any one?
Peter pi - M...
Star
12871 Points
1786 Posts
Re: wcf service hosted in iis 7
May 16, 2012 07:38 AM|LINK
If you disable metadata publish for this service, no wsdl file can describe this service, you cannot add service reference to this WCF service or you cannot use svcutil.exe to generate client proxy class and config file, so client cannot call your WCF service, as the page described, you need to set httpGetEnabled to true.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
SudhaRubini
Member
391 Points
383 Posts
Re: wcf service hosted in iis 7
May 16, 2012 07:45 AM|LINK
I send my appconfig file for your reference.
i set already httpGetEnabled = true.
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="WCFCalcIISSVC.CalcSVC" behaviorConfiguration="metadataBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost/CalcSVC.svc"/>
</baseAddresses>
</host>
<!--<endpoint address="ws" binding="wsHttpBinding" contract="WCFCalcIISSVC.ICalculator" bindingName="Binding1"></endpoint>-->
<endpoint address="basic" binding="basicHttpBinding" contract="WCFCalcIISSVC.ICalculator"></endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="Binding1">
<security mode="Message">
<message clientCredentialType="UserName" negotiateServiceCredential="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFCalcIISSVC.CustomUserNameValidator, WCFCalcIISSVC" />
</serviceCredentials>
<!-- 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>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Peter pi - M...
Star
12871 Points
1786 Posts
Re: wcf service hosted in iis 7
May 16, 2012 08:06 AM|LINK
see the above app config file, you are using message as security mode for wsHttpBinding, and in the <serviceCredentials> element to specify userNameAuthentication, but you have not applied wsHttpBinding in the endpoint. you can try deleting the following code from app.config.
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFCalcIISSVC.CustomUserNameValidator, WCFCalcIISSVC" />
</serviceCredentials>
or you uncomment the following code and modify it as follows:
<endpoint address="ws" binding="wsHttpBinding" contract="WCFCalcIISSVC.ICalculator" bindingConfiguration="Binding1"></endpoint>
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
SudhaRubini
Member
391 Points
383 Posts
Re: wcf service hosted in iis 7
May 16, 2012 08:57 AM|LINK
Uncommited the below code
<endpoint address="ws" binding="wsHttpBinding" contract="WCFCalcIISSVC.ICalculator" bindingConfiguration="Binding1"></endpoint>
and also commited to the
<serviceCredentials>
customUserNamePasswordValidatorType="WCFCalcIISSVC.CustomUserNameValidator, WCFCalcIISSVC" />
</serviceCedentials>
I run the service i got same page. as for like my first post..
Peter pi - M...
Star
12871 Points
1786 Posts
Re: wcf service hosted in iis 7
May 18, 2012 07:55 AM|LINK
It seems that if you host in IIS, specifying a base address is moot, since IIS will dictate where your service lives, you need to ensure that name of the <service> element is the same as the actual implementation service. Here is a article maybe you can refer.
http://stackoverflow.com/questions/4917761/wcf-metadata-publishing-for-this-service-is-currently-disabled-content-type-er
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework