Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`

后端 未结 16 2141
清歌不尽
清歌不尽 2020-12-04 15:42

EDIT:

After I modified the web.config and I don\'t get error that\'s good.... then I add a new page (html) and write this small code to consume the serv

相关标签:
16条回答
  • 2020-12-04 16:00

    In my case, on commenting out the

    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
    

    in the web.config file was throwing "Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata".

    0 讨论(0)
  • 2020-12-04 16:02

    I observed that when I removed SessionMode from the ServiceContract attribute, the issue went away.

    Example:

    [ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(ICallbacks))]
     public interface IStringReverser
     {
       [OperationContract]
       string ReverseString(string value);
     }
    

    to...

    [ServiceContract()]
     public interface IStringReverser
     {
       [OperationContract]
       string ReverseString(string value);
     }
    
    0 讨论(0)
  • 2020-12-04 16:04

    if working with .NET 4.0 WCF service - make sure Global.asax is not in the source directory. If it is , it is picked up at runtime and attempted to be compiled in...

    0 讨论(0)
  • 2020-12-04 16:04

    changing the Binding Type from wsHttpbinding to basichttp binding in the endpoint tag and from wsHttpbinding to mexhttpbinginding in metadata endpoint tag helped to overcome the error. Thank you...

    0 讨论(0)
  • 2020-12-04 16:13

    FYI - YOU CAN also get this error from a machine that is not having enough memory free. I got this error on a machine I run with 16 gigs of memory. I had a VM running with 6 gigs and a LOT of memory intensive apps. Close some down and this problem went away.

    I still did get the error in the title of the question of

    Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`

    I did notice a larger message about memory though in using the WCF Test Client.

    Hope this helps someone else.

    0 讨论(0)
  • 2020-12-04 16:15

    Change to older Visual Studio. Weird solution that worked for me. I was using Visual studio 2017, after changing to Visual Studio 2015 ,everything worked.

    0 讨论(0)
提交回复
热议问题