0

私はしばらくの間、このエラーに苦労してきました:

....8332/Service1.svc への HTTP 応答の受信中にエラーが発生しました。これは、サービス エンドポイント バインディングが HTTP プロトコルを使用していないことが原因である可能性があります。これは、HTTP 要求コンテキストがサーバーによって中止されたことが原因である可能性もあります (サービスのシャットダウンが原因である可能性があります)。詳細については、サーバー ログを参照してください。

エラーを追跡したところ、解決方法がわからないバインディングまたは接続に関係しているようです。..クラスと構成ファイルを以下に置きます。ご案内します。事前に感謝します。

    [DataContract]
    public class filepack
    {
        string  filesize = "0";
        int  accesspermitid =0;
         System.IO.Stream str ;


         [DataMember]
         public System.IO.Stream Filestr
         {
             get { return str; }
             set { str = value; }
         }

        [DataMember]
        public string Filesize
        {
            get { return filesize; }
            set { filesize = value; }
        }

        [DataMember]
        public int Accesspermitid
        {
            get { return accesspermitid; }
            set { accesspermitid = value; }
        }


    }

  <configuration>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

        </startup>

        <system.serviceModel>

            <behaviors>
                <endpointBehaviors>

                    <behavior name="debugbeh">
                        <dataContractSerializer />
                    </behavior>
                </endpointBehaviors>
            </behaviors>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService1" maxBufferSize="500000000"
                        maxReceivedMessageSize="500000000">
                        <security mode="None">
                            <message algorithmSuite="Default" />
                        </security>
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://localhost:8332/Service1.svc" behaviorConfiguration="debugbeh"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                    contract="vcpservice.IService1" name="BasicHttpBinding_IService1" />
            </client>

        </system.serviceModel>
    </configuration>







    <?xml version="1.0"?>
    <configuration>

      <system.diagnostics>
        <trace autoflush="true" />
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true">
            <listeners>
              <add name="sdt"
                  type="System.Diagnostics.XmlWriterTraceListener"
                  initializeData="c:\\logclientHOST.svclog"  />
            </listeners>
          </source>
        </sources>
      </system.diagnostics>

      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
      </system.web>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="mybinding" closeTimeout="00:10:00" maxBufferPoolSize="52428800"
              maxBufferSize="500000000" maxReceivedMessageSize="500000000" />
          </basicHttpBinding>
        </bindings>
        <diagnostics>
          <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
        </diagnostics>
        <behaviors>
          <endpointBehaviors>
            <behavior name="NewBehavior0">
              <dataContractSerializer />
            </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"
                httpGetBinding="webHttpBinding" httpGetBindingConfiguration="" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="2147483646" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
            <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>

    </configuration>
4

2 に答える 2

1

ストリームを送信できません。送信する前にストリームを最後まで読み取って実際のデータ オブジェクト (文字列またはバイト配列など) に具体化するか、本当にストリーミングが必要な場合は (これは疑問です)、thisを読み取ることができます。

于 2013-03-19T15:46:21.917 に答える
0

クラスからストリームを削除し、個別に返すことで問題が解決するようです! しかし、それがどのように解決に役立ったのかわかりません!

于 2013-03-24T16:14:01.990 に答える