คำตอบ "Endpoint not found" when trying to create a wcf service with webhttp binding.

  • 12 มีนาคม 2555 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>

ตอบทั้งหมด

  • 12 มีนาคม 2555 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
  • 12 มีนาคม 2555 14: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 12 มีนาคม 2555 14:11
    •  
  • 12 มีนาคม 2555 15: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 12 มีนาคม 2555 15:13 Didn't resolve my issue.
    •  
  • 12 มีนาคม 2555 21:31
     
     
    When using IIS endpoint address should be left blank
  • 13 มีนาคม 2555 6:00
     
     
    yes. The endpoint address is left blank. It didn't work.
  • 13 มีนาคม 2555 6: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> 

    • แก้ไขโดย Dragan Radovac 13 มีนาคม 2555 7:21
    • ทำเครื่องหมายเป็นคำตอบโดย Yi-Lun LuoModerator 16 มีนาคม 2555 9:28
    •  
  • 13 มีนาคม 2555 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

    • ทำเครื่องหมายเป็นคำตอบโดย Yi-Lun LuoModerator 16 มีนาคม 2555 9:28
    •  
  • 17 มีนาคม 2555 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.

  • 17 มีนาคม 2555 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


    • แก้ไขโดย Dragan Radovac 17 มีนาคม 2555 12:31
    • ทำเครื่องหมายเป็นคำตอบโดย Chittilapilly 20 มีนาคม 2555 12:26
    •