2011-05-09 3 views
1

내 프로젝트에서 사용자가 웹 서비스에 사진을 업로드 할 수있는 wcf의 편안한 서비스.transferMode를 "Streamed"로 변경 한 후 wcf의 편안한 도움말 페이지를로드 할 수 없습니다.

대용량 파일 업로드를 허용하도록 구성 설정을 변경 한 후. (바인딩 구성 추가, 즉 "TransferMode", "BufferSize"등) 모든 운영 계약이 모두 예상대로 작동합니다.

그러나 엔드 포인트에 대한 서비스 도움말 페이지가 작동하지 않습니다. 나는이 문제를 해결하려면 어떻게 내 엔드 포인트

에 바인딩 구성 설정을 제거하면

도움말 페이지

는 다시 온다? 내가

를 놓친했다 어디 모든

<bindings> 
      <webHttpBinding> 
       <!-- buffer: 64KB; max size: 64MB --> 
       <binding name="StreamedBinding" closeTimeout="00:01:00" openTimeout="00:01:00" 
         receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed" 
         maxBufferPoolSize="67108864" maxBufferSize="65536" maxReceivedMessageSize="67108864"> 
       </binding> 
      </webHttpBinding> 
</bindings> 

<service name="WCFRestFul.ApiRestful"> 
     <endpoint address="" binding="webHttpBinding" 
        bindingConfiguration="StreamedBinding" bindingName="StreamedBinding" 
        contract="WCFRestFul.IApiRestful" behaviorConfiguration="web" /> 
</service> 

업데이트 감사합니다 : 나는 그냥 때문에 전송 모드이 아닌 생각하지만, 어쩌면 다른뿐만 아니라 설정. 위의 코드에서 "bindingConfiguration"을 제거하면 서비스 도움말 페이지가 다시 나타납니다. 2 개의 끝점이 있습니다. 다른 끝점에는 "bindingConfiguration"이 없으므로 서비스 도움말 페이지가 제대로 작동합니다. 나는 확실히 여기에 어떤 것을 놓쳤다. 어떤 도움을 주시면 대단히 감사하겠습니다.

답변

1

나는 carlosfigueira 조언을 사용하여 한 번에 하나씩 구성 설정을 제거했습니다.

나는

OLD 코드

<bindings> 
      <webHttpBinding> 
       <!-- buffer: 64KB; max size: 64MB --> 
       <binding name="StreamedBinding" closeTimeout="00:01:00" openTimeout="00:01:00" 
         receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed" 
         maxBufferPoolSize="67108864" maxBufferSize="65536" maxReceivedMessageSize="67108864"> 
       </binding> 
      </webHttpBinding> 
</bindings> 

으로 최종 작업 버전 (된 transferMode = "스트리밍"제거)

<bindings> 
<webHttpBinding> 
<binding name="StreamedBinding" maxReceivedMessageSize="67108864" /> 
</webHttpBinding> 
</bindings> 

결국 서비스에서 내 설정 설정을 변경 도움말 페이지가 다시 나타납니다.

그러나 내가 왜 꺼 졌는지와 같은 이유가 무엇인지 이해할 수 없습니다.

어쨌든, 이것이 제 경우에 대한 해결책입니다. 누군가 도움이 되길 바랍니다.

0

작동이 중지되었다고 말하는 것은 무엇을 의미합니까? 아래 예에서 도움말 페이지는 서비스에서 계속 반환됩니다 (IE와 Chrome을 모두 사용하여 페이지를 볼 수있었습니다).

public class StackOverflow_5937029 
{ 
    [ServiceContract] 
    public interface ITest 
    { 
     [WebGet] 
     int Add(int x, int y); 
    } 
    public class Service : ITest 
    { 
     public int Add(int x, int y) 
     { 
      return x + y; 
     } 
    } 
    static void SendRequest(string address) 
    { 
     HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(address); 
     req.Method = "GET"; 

     HttpWebResponse resp; 
     try 
     { 
      resp = (HttpWebResponse)req.GetResponse(); 
     } 
     catch (WebException e) 
     { 
      resp = (HttpWebResponse)e.Response; 
     } 

     Console.WriteLine("HTTP/{0} {1} {2}", resp.ProtocolVersion, (int)resp.StatusCode, resp.StatusDescription); 
     foreach (string headerName in resp.Headers.AllKeys) 
     { 
      Console.WriteLine("{0}: {1}", headerName, resp.Headers[headerName]); 
     } 

     Console.WriteLine(); 
     Stream respStream = resp.GetResponseStream(); 
     Console.WriteLine(new StreamReader(respStream).ReadToEnd()); 

     Console.WriteLine(); 
     Console.WriteLine(" *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* "); 
     Console.WriteLine(); 
    } 
    public static void Test() 
    { 
     string baseAddress = "http://" + Environment.MachineName + ":8000/Service"; 
     ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress)); 
     WebHttpBehavior behavior = new WebHttpBehavior 
     { 
      HelpEnabled = true 
     }; 
     WebHttpBinding binding = new WebHttpBinding 
     { 
      TransferMode = TransferMode.Streamed 
     }; 
     host.AddServiceEndpoint(typeof(ITest), binding, "").Behaviors.Add(behavior); 
     host.Open(); 
     Console.WriteLine("Host opened"); 

     SendRequest(baseAddress + "/Add?x=4&y=8"); 
     SendRequest(baseAddress + "/help"); 

     Console.Write("Press ENTER to close the host"); 
     Console.ReadLine(); 
     host.Close(); 
    } 
} 
+0

업데이트를 참조하십시오. 이는 전송 모드 때문 만이 아니라 구성 설정의 기본 항목 일 수도 있습니다. –

+0

빈 바인딩 구성으로 시작하여 도움말 페이지가 계속 표시되는지 확인하십시오. 그렇지 않은 경우 속성을 추가 할 때까지 속성을 한 번에 하나씩 추가하기 시작합니다. 그러면 문제에 대한 자세한 정보를 얻을 수 있습니다. – carlosfigueira