내 로컬 컴퓨터에 클라이언트 응용 프로그램과 원격 데이터베이스 간의 "브리지"처럼 작동하는 WCF 서비스가 있습니다.WCF 오류 400 잘못된 POST 요청시 일부 데이터가
WCF 서비스는 Entity Framework 클래스와 함께 작동하며 데이터를 가져올 때 제대로 작동하지만 아무것도 게시하지 않고 다음 오류 메시지가 나타날 때 작동하지 않습니다. "(400) Bad Request".
//Connect to WCF Service
CHS_Local.ServiceFrontalClient proxy = new CHS_Local.ServiceFrontalClient();
//Get a "Client" class wich ClientID == 1
CHS_Local.Client client = proxy.GetClient(1);
//Change some stuff
client.Name = "change someting";
//Send the modified class to service to update the database
proxy.UpdateClient(client);
WCF 구성 파일에서이 내 <system.serviceModel>
태그 :
이 내 클라이언트 코드
<system.serviceModel>
<services>
<service name="CentralizedHostingService.ServiceFrontal">
<endpoint
address=""
binding="wsHttpBinding"
contract="CentralizedHostingService.IServiceFrontal">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/CentralizedHostingService/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
그리고 클라이언트 응용 프로그램에서 내 app.config
:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IServiceFrontal" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="5000000"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas
maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows"
proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint
address="http://localhost:8732/Design_Time_Addresses/CentralizedHostingService/Service1/"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IServiceFrontal"
contract="CHS_Local.IServiceFrontal" name="WSHttpBinding_IServiceFrontal">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
서비스 인터페이스 :
[OperationContract]
Client GetClient(int clientID);
[OperationContract]
void UpdateClient(Client editedClient);
첫 번째 경우에는 문제가 청원의 무게에 있지만, 청원서를 보내는 바이트는 115.903 바이트 (~ 0.11MB)에 불과하다는 피들러를 사용합니다. 아이디어가 있으십니까? ! 당신이 볼 수 있듯이
은 간단한 예입니다하지만 할 수는없는 일 :(
덕분에 당신이 도움을 :)
는 서비스 interace 여기 – Aliostad