我搜索了很多论坛,但我很困惑我必须在web.config文件中做哪些设置以及我必须做什么?我有两个应用程序单独1.Asp.net应用程序2.WCF服务应用程序;我在我的Asp.net应用程序中添加了服务引用。这些应用程序不在IIS上托管我正在我的本地机器上测试它。请提供指导线将上传的文件传递给服务应用程序。
Asp.net应用程序web.config
<configuration>
<configSections>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWCF" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:7147/WCFService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IWCF" contract="HostedWCF.IWCF"
name="BasicHttpBinding_IWCF" />
</client>
</system.serviceModel>
服务应用程序Web.config
<configuration>
<connectionStrings>
<!--<add name="DPOConnectionString" connectionString="Data Source=s15346491\SQLEXPRESS;Database=DatabaseName;Uid=UserID;Password=password;"/>-->
<add name="ConnectionString" connectionString="Data Source=SWAPNIL-PC;Initial Catalog=PayrollNet;Integrated Security=True" />
</connectionStrings>
<appSettings>
<add key="LogoPath" value="C:\Users\HARSH12\Desktop\New Conversion 26-7-2013\ConstructionApplication\CMSERPService\ErrorLog\ErrorLog.txt" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<add value="WCFService.svc" />
</files>
</defaultDocument>
</system.webServer>
答案 0 :(得分:1)
试试这个
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWCF" closeTimeout="00:01:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>