이상한 행동 :WCF 나는 웹 서비스 소비 때이있어
계약 'IServices'운영 '로그인'어떤 래퍼 요소없이 직렬화 여러 요청 본문 매개 변수를 지정합니다. 최대 하나의 본문 매개 변수는 래퍼 요소없이 직렬화 할 수 있습니다. 여분의 본문 매개 변수를 제거하거나 WebGetAttribute/WebInvokeAttribute의 BodyStyle 속성을 Wrapped로 설정하십시오.
내가 좋아하는 인터페이스 모양 사용하십시오이 될 것입니다
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);
}
}
을하고 난 후, 나는 내 사이트에 웹 참조를 추가를 호스팅하고 그러한에서 web.config를 수정
<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>
같은 어떤 생각이 오류를 해결하는 방법?
이러한 속성이 꾸미는 메소드의 서명을 표시하십시오. –
ok public string login (string userid); – AMH
public void InsertUpdateWallet (string userid, string amount) – AMH