Wcf 如何在MVC中使用我的web引用?

Wcf 如何在MVC中使用我的web引用?,wcf,model-view-controller,interface,web-reference,Wcf,Model View Controller,Interface,Web Reference,问候朋友,我需要在我的MVC应用程序中引用外部服务 我正在使用此服务验证我们的一个客户端请求我们使用的身份验证令牌 我正在将一个较旧的项目移植到MVC。 我添加了一个网络参考 var service = new ExternalServices(); Assertion assertion = service.Validate(Id); if(assertion.Valid){} 配置是这样生成的: <system.serviceModel

问候朋友,我需要在我的MVC应用程序中引用外部服务

我正在使用此服务验证我们的一个客户端请求我们使用的身份验证令牌

我正在将一个较旧的项目移植到MVC。 我添加了一个网络参考

        var service = new ExternalServices();
        Assertion assertion = service.Validate(Id);
        if(assertion.Valid){}
配置是这样生成的:

<system.serviceModel>
<bindings>
    <basicHttpBinding>
        <binding name="ExternalServicesSoap" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None"
                    realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>
<client>
    <endpoint address="http://myapps.test.com/ExternalServices/ExternalServices.asmx"
        binding="basicHttpBinding" bindingConfiguration="ExternalServicesSoap"
        contract="AssertionService.ExternalServicesSoap" name="ExternalServicesSoap" />
</client>
在MVC项目中,情况似乎并非如此。 我似乎在和WCF合作。 我不确定我在MVC世界中是否正确处理了这个问题

我只需要使用ExternalServicesSoap接口或ExternalServicesSoapChannel接口。 它们都不会像ASP.Net世界中那样返回断言对象。 它们都有Validate方法,但返回validateasertionresponse。 响应对象没有任何有用的属性;只是一个回应机构。 断言类仍然是可访问的,但似乎没有任何接口方法返回它

有人能帮我正确使用这些接口吗


谢谢

与其添加服务引用,不如添加Web引用。右键单击项目,选择“添加服务引用…”。在“添加服务引用”对话框中,单击“高级”,然后单击“添加Web引用”。这将生成一个适合与基于ASMX的服务一起使用的代理