바이트 배열을 보내려고 할 때 잘못된 요청 오류가 발생합니다. 모든 메시지 제한에 대한 최대 값을 확인했습니다. 모두 최대 값으로 설정됩니다. 그러나 바이트 배열 매개 변수를 null로 유지하여 서비스 메서드에 문자열 값을 보낼 수 있습니다. 왜 이런 일이 일어나는지 모르겠습니다. 또한 서비스 동작 구성 이름과 바인딩 구성 이름 (즉, 포함 된 네임 스페이스)을 확인했습니다. 도움이된다면 큰 도움이 될 것입니다.비누를 사용하여 wcf에 바이트 배열 전달
....
ServiceClient ac = new ServiceClient();
string ServiceUrl = "http://localhost:20314/Service.svc";
EndpointAddress address = new EndpointAddress(ServiceUrl);
BasicHttpBinding httpbinding = new BasicHttpBinding();
using (ChannelFactory<IServiceChannel> factory = new ChannelFactory<IServiceChannel>(httpbinding))
{
factory.Endpoint.Address = address;
using (IServiceChannel oService = factory.CreateChannel())
{
using (OperationContextScope scope = new OperationContextScope(oService))
{
Guid myToken = new Guid("guid here");
MessageHeader<Guid> mhg = new MessageHeader<Guid>(myToken);
MessageHeader untyped = mhg.GetUntypedHeader("identity", "ns");
OperationContext.Current.OutgoingMessageHeaders.Add(untyped);
// here i am getting bad request error
var fdt = (oService).GetData(bytearray, value);
}
}
}
.......
클라이언트 웹 설정 :
이 내 클라이언트 측 코드
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime maxRequestLength="500000000" executionTimeout="360"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="01:01:00"
openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:20314/Service.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService" contract="LocalService.IService"
name="BasicHttpBinding_IService"/>
</client>
<services>
<service name="LocalService.Service" behaviorConfiguration="ServiceBehavior">
<endpoint address="http://localhost:20314/Service.svc" binding="wsHttpBinding" contract="LocalService.IService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
서비스 웹 구성
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="500000000" executionTimeout="360"/>
</system.web>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceAuthorization serviceAuthorizationManagerType="ServiceApp.APIKeyAuthorization, ServiceApp" />
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint
automaticFormatSelectionEnabled="true"
helpEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
내 시간을 저장했습니다. –
동일한 오류가 발생했기 때문에 서비스 구성 측에서 서비스를 추가하는 대신 첫 번째 방법을 취소했습니다. –
첫 번째 접근 덕분에 어떻게 작동했는지 알 수있었습니다. –