WCF Rest WebHttpBinding无法查找端点

时间:2016-05-09 08:25:11

标签: c# wcf wcf-rest

我在MVC应用程序中托管它之后找不到我的服务端点,当我调试时,我可以进入服务的基类并进入服务类但是在我得到之后

  

未找到端点。

我将https://localhost:44302/api/brokerapi/ProvideAccountHoldings/称为方法

[BrokerServiceAspect(AttributeTargetElements = MulticastTargets.Method)]
[IPLoggingAspect(AttributeTargetElements = MulticastTargets.InstanceConstructor)]
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, InstanceContextMode = InstanceContextMode.PerCall, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class BrokerAPIService : ServiceBase, IBrokerAPIService, IIPLog
{
    //log pc data
    // IPLog log = null;

    //public BrokerAPIService()
    //{
    //    IPLogUtility iplog = new IPLogUtility();
    //    log = iplog.LogIP(OperationContext.Current);
    //}
    public BrokerAPIService()
        : base()
    { }

    public IEnumerable<Domain.Model.Holding> ProvideAccountHoldings()
    {
        return DB.ProvideAccountHoldings();
    }

来自界面

[ServiceContract(
SessionMode = SessionMode.Allowed,
ProtectionLevel = System.Net.Security.ProtectionLevel.None)]
public interface IBrokerAPIService
{
    [OperationContract]
    [WebGet(ResponseFormat = WebMessageFormat.Json)]
    [FaultContract(typeof(GeneralException))]
    IEnumerable<Holding> ProvideAccountHoldings();

我甚至尝试过添加

  

UriTemplate =“/ ProvideTransactions”

无济于事,有什么我想念的吗? 这是我的配置

 <webHttpBinding>
    <binding name="webHttpBinding" bypassProxyOnLocal="false">
      <security mode="Transport">
        <!--<transport clientCredentialType="Basic" />-->
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="webBehaviour" name="AOS.BrokerAPI.WCFService.BrokerAPIService">
    <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange" />
    <endpoint address="brokerapi" binding="webHttpBinding" bindingConfiguration="webHttpBinding"
      name="web" contract="AOS.BrokerAPI.WCFService.IBrokerAPIService" behaviorConfiguration="EndPointBehaviour"/>
    <host>
      <baseAddresses>
        <!--<add baseAddress="http://localhost:8733/Design_Time_Addresses/AOS.BrokerAPI.WCFService/BrokerAPIService/" />
        <add baseAddress="https://localhost:8732/Design_Time_Addresses/AOS.BrokerAPI.WCFService/BrokerAPIService/" />-->
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="EndPointBehaviour">
      <!--<enableWebScript />-->
      <webHttp faultExceptionEnabled="false" />
    </behavior>
  </endpointBehaviors>

提前致谢。

0 个答案:

没有答案