Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Can anyone tell me why I get this error when I try to add my service?

Error: Cannot obtain Metadata from http://myserver/myapp. If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455. WS-Metadata Exchange Error URI: http://myserver/myapp Metadata contains a reference that cannot be resolved: 'http://myserver/myapp'. The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed.HTTP GET Error URI: http://myserver/myapp There was an error downloading 'http://myserver/myapp'. The request failed with HTTP status 403: Forbidden.

Update: I have the following endpoint already,

<endpoint address="mex" 
          binding="mexHttpBinding"
          name="Metadata"
          contract="IMetadataExchange" />

I also have the service behaviors set:

  <serviceBehaviors>
    <behavior name="myBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
837 views
Welcome To Ask or Share your Answers For Others

1 Answer

I had this issue, turns out that when I renamed the .svc file a reference to it hadn't been renamed from Service1.svc. Run a project wide search and replace .Service1 with your new name.

<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.Service1" CodeBehind="MyRenamedService.svc.cs" %>

Service="MyNamespace.Service1" should read Service="MyNamespace.MyRenamedService"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...