WCF seltsames Verhalten
Ich habe folgendes erhalten, als ich einen Webservice konsumiere:
Die Operation "Login" des Vertrags "IServices" gibt mehrere Anforderungshauptteilparameter an, die ohne Wrapper-Elemente serialisiert werden sollen. Maximal ein Body-Parameter kann ohne Wrapper-Elemente serialisiert werden. Entfernen Sie entweder die zusätzlichen body-Parameter oder setzen Sie die BodyStyle-Eigenschaft in WebGetAttribute / WebInvokeAttribute auf Wrapped.
Ich benutze Schnittstelle wie folgt aussehen:
namespace DreamServices
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IServices
{
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "LogIn/{username}/{password}")]
string Login(string username, string password);
[OperationContract]
[WebInvoke(
Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "WaletTotalAmount/{userid}")]
double? WaletTotalAmount(string userid);
[OperationContract]
[WebInvoke(
Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "UserService/{userid}")]
IList<UserServiceses> UserService(string userid);
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "InsertUpdateWallet/{userid}/{Amount}/{ComissionAmount}")]
void InsertUpdateWallet(string userid, string Amount, string ComissionAmount);
}
}
und ich hoste es, dann füge ich einen Webverweis zu meiner Site hinzu und ändere die web.config so, dass sie dem entspricht
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="defaultRest">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="64" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1381/PMAHost/Service.svc" binding="webHttpBinding" contract="ServiceReference.IServices" behaviorConfiguration="web"/>
</client>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Irgendeine Idee, wie man diesen Fehler behebt?