0
我正在開發一個使用C#.NET的web服務。所有的工作都很好,但因爲我已經改變了我的web.config文件,我從服務器報告404返回錯誤 - 找不到文件。 在服務的構造函數完成之後以及調用服務操作之前發生異常。 如果我從web.config中刪除服務部分,它將再次工作。我需要允許更高的郵件大小,因爲我想進行一些文件傳輸,並且不想將文件(主要在zip和1到150MB之間)分割成小於30kb的小塊以使其工作。所以我需要提高允許的響應大小。 我不知道爲什麼服務崩潰,但我相信這是什麼毛病我的web.config:c#REST風格的Web服務 - 自改變web.config以來的錯誤404
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add
name="MyDSNName"
connectionString="MyConnectString"
/>
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<!--
LogLevel DefaultValue: E_ALL, ^E_NOTE, ^E_HINT, ^E_INFO, ^E_TRACE
Represents: E_ALL, without E_NOTE, E_HINT, E_INFO and E_TRACE
Avaiable: E_ERROR, E_WARNING, E_DEBUG, E_TRACE,
E_HINT, E_INFO, E_NOTE, E_SYSTEM, E_BOOT, E_ALL
Development Value: E_ALL, ^E_HINT, ^E_INFO
Production Value: E_SYSTEM, E_ERROR, E_WARNING, E_HINT
-->
<add key="loglevel" value="E_ALL"/>
</appSettings>
<system.web>
<compilation debug="true" optimizeCompilations="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="2147483647"
maxQueryStringLength="2097151"/>
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="UpdateServiceCfg" receiveTimeout="00:10:00"
sendTimeout="00:10:00" openTimeout="00:10:00"
closeTimeout="00:10:00" maxReceivedMessageSize="10485760"
transferMode="Streamed">
<security mode="None"/>
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"
maxDepth="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="UpdateServiceBehavior" name="MyApp.UpdateService">
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding"
bindingConfiguration="UpdateServiceCfg" contract="MyApp.IUpdateService" />
<host>
<timeouts closeTimeout="00:10:00" />
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp helpEnabled="false" faultExceptionEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="UpdateServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
誰能給我一個提示,來解決這個問題?
在此先感謝。
我猜behaviorConfiguration =「網絡」將是behaviorConfiguration =「UpdateServiceBehavior」 – Adil 2015-02-06 10:23:52
我想你應該定義端點地址 – 2015-02-06 10:24:42
@Adil使用UpdateServiceBehavior而不是網頁將被標記爲錯誤 – DaKirsche 2015-02-06 10:27:51