简体   繁体   中英

Self Hosted (console) WCF configuration

i had a WCF server running through a Console application, it will run as an azure service so i don't to host it in ISS.

I belived it work well and share datas to my web app through ajax request. But when i maked a service that recieve a filestream, i realized that my binding configuration is not used at all. My WCF work same without binding section.

My probleme concerne especially the key "maxReceivedMessageSize" because default value limit me to 8Ko request and it is a problem for uploading file.

Bindings section (that i can comment) :

<webHttpBinding>
    <binding name="MyBindingConfig" crossDomainScriptAccessEnabled="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Buffered">
      <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="None" />
    </binding>
  </webHttpBinding>

Services section :

<service name="MyData.Service.MyDataServiceRestFull">
    <endpoint binding="webHttpBinding"
              contract="MyData.Service.IMyDataServiceRestFull" bindingName="MyBindingConfig" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9997/MyDataServer"/>
      </baseAddresses>
    </host>
  </service>

Note that i tryed with basicHttpBinding and i had same issue.

The problem is that you're incorrectly referring to your binding in your <endpoint/> element. You're using the bindingName attribute, when you should be using the bindingConfiguration attribute:

<endpoint binding="webHttpBinding"
          contract="MyData.Service.IMyDataServiceRestFull"
          bindingConfiguration="MyBindingConfig" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM