我一直在努力解决这个错误:
接收对 ....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>