"Endpoint not found" when trying to create a wcf service with webhttp binding.

已答覆 "Endpoint not found" when trying to create a wcf service with webhttp binding.

  • 2012年3月12日 上午 11:08
     
      包含代碼

     <system.serviceModel>
        <services>
          <service name="Uploadfile.wcfsvcUploadfile">
                <endpoint address="" binding="webHttpBinding" name="RestEndpoint"  contract="Uploadfile.Iuploadfile" behaviorConfiguration="restBehavior"/>
          </service>
        </services>
        <behaviors>
          <endpointBehaviors>
            <behavior name="restBehavior">
              <webHttp />
            </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior>
                       <serviceMetadata httpGetEnabled="true"/>
                        <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

所有回覆

  • 2012年3月12日 上午 11:25
     
      包含代碼

    Works fine for me when I put the below <endpoint> into the <service>

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetaDataExchange"/>
    You need this code if you are trying to get at the metadata of your service
  • 2012年3月12日 下午 02:10
     
     

    Please post IUploadFile interface and also how you are hosting to help you more quickly.

    If hosting in IIS, make sure you have your endpoint address as shown below:

    http://localhost/virtualdirectoryname/resourcename 

    resource name as specified on your webget/webinvoke attribute.

    • 已編輯 Rajesh S V 2012年3月12日 下午 02:11
    •  
  • 2012年3月12日 下午 03:12
     
      包含代碼

    it didn't help. Basically, what I am trying to do is, to upload a file from my client web application to a wcf service.
    I am also inserting my interface here.

    public interface Iuploadfile
        {
            [OperationContract]
            [WebGet]
            string GetData(int value);
            [OperationContract]
            [WebInvoke(UriTemplate="FileUpload/{fileName}")]
            void Uploadfile (string fileName, Stream fileStream);
        }

    • 已編輯 Chittilapilly 2012年3月12日 下午 03:13 Didn't resolve my issue.
    •  
  • 2012年3月12日 下午 09:31
     
     
    When using IIS endpoint address should be left blank
  • 2012年3月13日 上午 06:00
     
     
    yes. The endpoint address is left blank. It didn't work.
  • 2012年3月13日 上午 06:59
     
     已答覆 包含代碼

    I see your problem. When using a stream you can't pass another parameter. You can only have a stream. eg:

    void Uploadfile (Stream fileStream);
    Stream Uploadfile (Stream fileStream);
    Stream Uploadfile ();

    Above shows the three ways you can use Operations with streams

    1. Pass a stream with no return

    2. Pass a stream and return a stream

    3. No parameter But return a stream

    Also, add this as a binding configuration

          <webHttpBinding>
            <binding name="webHttp" transferMode="StreamedRequest">          
            </binding>
          </webHttpBinding> 

  • 2012年3月13日 上午 11:52
     
     已答覆
    As said when you require a Stream parameter you cannot have another parameter that can be passed but as an alternative you can use a MultiPartParser that would seperate multiple parts of a stream.

    Rajesh S V

  • 2012年3月17日 上午 11:55
     
     

    Community ContentAdd

     
    Annotations FAQ
    Error in restrictions section

    "Operations that occur across a streamed transport can have a contract with at most one input or output parameter."

    This is not correct with respect to WebHttpBinding.  In .NET 4.0 the contract for streaming request can have several parameters, the last of which must be a Stream.

  • 2012年3月17日 下午 12:22
     
     已答覆

    Hi, this article seems to confirm what say. Read the answer carefully as it may give you a solution:

    http://stackoverflow.com/questions/6366489/wcf-rest-webservice-with-stream

    Please respond with your findings.

    Here is another article confirming your input that has examples of how to implement a solution:

    http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-receiving-arbitrary-data.aspx