WCF Metadata publishing for this service is currently disabled + Content Type error

后端 未结 6 887
再見小時候
再見小時候 2020-12-08 07:32

That Metadata error is what I get when I browse to the service in a browser. I am not consuming it with a client

and Yes.. I added

相关标签:
6条回答
  • 2020-12-08 07:52

    I had another issue. I have an IIS asmx application, and inside I've placed a subfolder with svc. Configured it properly, but it didn't give me the metadata until I found this in web.config in parent directory:

    <system.web>
      <webServices>
        <soapExtensionTypes>
          <add type="SPFWebService.SPFWebServiceExtension,App_Code" priority="1" group="0" />
        </soapExtensionTypes>
      </webServices>
    </system.web>
    

    Fixed it by removing my new service to a separate directory.

    0 讨论(0)
  • 2020-12-08 07:56

    Encountered a similar issue. I had the wrong namespace in my service tag in web.config as against the namespace for the service class in the svc file.

    web.config

    < service name="X.Y.Z.ContentService" behaviorConfiguration="XServiceBehavior">
    

    svc file

    <%@ ServiceHost Language="C#" Debug="true" Service="X.Y.A.ContentService" %>
    

    As seen above, service tag in web.config had namespace X.Y.Z where the svc file had X.Y.A.

    (Thanks to Marc)

    0 讨论(0)
  • 2020-12-08 08:00

    Your code and config seems fine - except for one little point:

    In your <service> tag, you have defined a name that doesn't seem to correspond to the class that actually implements your service:

    <service name="DestructionServices.Destro"  ......>
                   ************************** 
    

    but your class is:

    namespace DestructionServices
    {
        .....
        public class TacticalNukeSVC : INukeInterface
        {
    

    Those names need to match! The name= attribute on the <service> tag in config must be exactly what your service class is called - fully qualified, including namespace - so in your case here, it should be:

    <service name="DestructionServices.TacticalNukeSVC" ......>
    
    0 讨论(0)
  • 2020-12-08 08:03

    if you have a class with no default constructor an another constructors , then add an empty default constructor , I had the same issue and i resolved it by this .

    0 讨论(0)
  • 2020-12-08 08:05

    Previously working WCF with nice~ settings stopped working and shows - error- Metadata publishing for this service is currently disabled.

    THOUGH MEX Settings are perfect, still WCF shows above error, reason: The virtual directory created from VS IDE IS NOT Created, though it gives "success" message..

    Just Create Virtual Directory in IIS manually , Bingo error is resolved.

    Hope it helps!

    0 讨论(0)
  • 2020-12-08 08:15

    I had a similar issue. For anyone that might come across this later. My problem was that my service interface did not have the [ServiceContract] DataAnnotation

    [ServiceContract] //<--This was missing
    public interface IServiceInterface
    {
        [OperationContract]
        void Foo(Bar bar)
        //...
    }
    
    0 讨论(0)
提交回复
热议问题