.Net 4.0 WCF service error passing parameters

I am trying to test the WCF service using the basichttpbinding endpoint from the WCF test client. I can check the methods with which I do not pass parameters without problems, but when I need to pass a parameter, I get the following error:

Failed to call the service. Possible reasons: the service is disabled or unavailable; client side configuration does not match proxy; existing proxy is invalid. Refer to the stack trace in detail. You can try to restore the launch of a new proxy server, restore the default setting, or update the service.

An error occurred while executing the command definition. See Internal Exception for details.

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood (Message response, MessageFault error, action string, MessageVersion version, FaultConverter faultConverter) with System.ServiceModel.Channels.ServiceChannel.HandleReply (ProxyOpcRpRration) .ServiceModel.Channels.ServiceChannel.Call (String action, Boolean oneway, Operation ProxyOperationRuntime, Object [] ins, Object [] of outs, TimeSpan timeout) in System.ServiceModel.Channels.ServiceChannel.Call (String action, Boolean onewOperation Operation Proxy , Object [] ins, Object [] outs) in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage method Call, ProxyOperationRuntime operation) when System.ServiceModel.Channels.ServiceChannelProxy.Invoke (iMessage message)

, [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage( reqMsg, IMessage retMsg) System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & msgData, Int32) IErouter.GetClientSearch(String , String forename, String , ) ErouterClient.GetClientSearch(String , String forename, String , )

- , , .

[ServiceContract]
public interface IErouter
{
    #region Client Search

    [OperationContract]
    SelectClientSearch_Result[] GetClientSearch(
        string surname, string forename, string street, string postcode);

    #endregion

    #region Changes

    [OperationContract]
    ChangeForBlackBerry[] GetClientChanges(string blackberryPin);

    [OperationContract]
    bool AcceptChange(int changeId, string blackberryPin);

    [OperationContract]
    bool AcknowledgeChange(int changeId, string blackberryPin);

    [OperationContract]
    ChangeForBlackBerry[] GetManagerChangesForShiftType(string blackberryPin, 
        string date, int shiftTypeId);

    [OperationContract]
    ClientDetailChangeViewModel GetClientDetailChange(int changeId);

    #endregion

    #region Client Details

    [OperationContract]
    ClientDetailViewModel GetClientDetails(int clientId);

    [OperationContract]
    SelectUserLevel_Result GetUserLevel(string blackberryPin);

    #endregion

    #region Useful Contacts

    [OperationContract]
    SelectAdminCentreTelNo_Result[] GetAdminCentreTelNos();

    [OperationContract]
    string GetDutyEmail();

    [OperationContract]
    SelectDutyManager_Result[] GetDutyManagerTelNos();

    [OperationContract]
    string GetGhaHandyTelNo();

    [OperationContract]
    SelectHospitalNos_Result[] GetHospitalTelNos();

    [OperationContract]
    string GetICTTelNo();

    [OperationContract]
    string GetMAHMobileTelNo();

    [OperationContract]
    SelectMyManagerNo_Result[] GetMyManagerTelNo(string blackberryPin);

    [OperationContract]
    string GetNHSDirectTelNo();

    [OperationContract]
    string GetOOHEmail();

    [OperationContract]
    string GetOOHTelNo();

    [OperationContract]
    string GetOperationsEmail();

    [OperationContract]
    string GetOperationsTelNo();

    [OperationContract]
    string GetOtherHandyPersonTelNo();

    [OperationContract]
    SelectSWTelNos_Result[] GetSWTelNo();

    #endregion

    #region Gaurdian 24 Visit Monitoring

    [OperationContract]
    string StartVisitMonitoring(int clientId, int activityDuration, 
        string activityText, string blackberryPin);

    [OperationContract]
    string StopVisitMonitoring(int clientId, string activityId, 
        string blackberryPin);

    #endregion
}
+3
3

... WCF !:)

0

- , [DataContract] [Serializable] SelectClientSearch_Result.

+1

, web.config :

<serviceHostingEnvironment>
    <baseAddressPrefixFilters>
        <add prefix="http://host:port"/>
    </baseAddressPrefixFilters>
</serviceHostingEnvironment>

If this does not work, you can try adding the above and removing the elements: <host></host>(idea from the last link that I linked)

Just adding the following to web.config can help.

<system.serviceModel>        
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />    
</system.serviceModel>

I read the following sites:

http://msdn.microsoft.com/en-us/library/aa702682.aspx
http://msdn.microsoft.com/en-us/library/ms731336.aspx
http://community.discountasp.net/showthread.php?t=7719

One mentioned that the WCF service behaves exactly the same as the ASMX service, so I thought it might be relevant.

EDIT:

Can I read quickly? http://support.microsoft.com/kb/958478

+1
source

Source: https://habr.com/ru/post/1777946/


All Articles