简体   繁体   中英

Can't find WCF Endpoint for service

I'm currently adding a WCF Service to my project, but I'm having trouble connecting to the service. I have two other services with similar configurations that work fine, and I can't find the reason why my new one is not connecting. When I try to connect to the endpoint, I get the following issue:

The type 'MyProject.MyServices.MyService, MyProject, Version=1.5.8.20715, Culture=neutral, PublicKeyToken=PUBLICKEY', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

I've tried setting the Service attribute in my .svc to the other two implementations and those work fine.

myService.svc

<%@ServiceHost language="C#" Debug="true" 
    Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressDataServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=PUBLICKEYTOKEN" 
    Service="MyProject.MyServices.MyService, $SharePoint.Project.AssemblyFullName$" %>

MyService.cs


    /// <inheritdoc />
    //[SuppressMessage("Microsoft.Security", "CA2135", Justification = "Using Level 1 Security Rules as per Chuck's SP2016 Upgrade.")]
    //[SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
    //[SharePointPermission(SecurityAction.InheritanceDemand, ObjectModel = true)]
    [BasicHttpBindingServiceMetadataExchangeEndpoint]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, IncludeExceptionDetailInFaults = true)]
    [ServiceContract]
    public class MyService  : DataService<MyDataContext>
    {
        private SPWeb _web;

        #region Constructor
        /// <summary>
        /// Default constructor
        /// </summary>
        public MyService() : base()
        {

        }

        #endregion
        #region Methods

        /// <summary>
        /// Method for handling the incoming request
        /// </summary>
        /// <param name="args">The arguments for the request</param>
        override protected void OnStartProcessingRequest(ProcessRequestArgs args)
        {
        }

        [OperationContract]
        public string AddTwoNumbers()
        {
            return "I love WCF Services";
        }
        #endregion
    }

I'm expecting an "Endpoint not found", but I am getting the serviceActivations error described above instead.

In my opinion, there is something wrong with the incorrect file/directory structure of your WCF web application, which caused this issue, could not find the right file.
For details, please refer to the below link.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/4aab8a20-f39f-4c8d-aad2-8762ef87a66c/systemservicemodelservicehostingenvironmentserviceactivations-could-not-be-found?forum=wcf
Feel free to let me know if the problem still exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM