Populate routetable of wcf from database

徘徊边缘 提交于 2020-01-24 20:59:48

问题


I want to add end points dynamically to routing table of wcf.

Code:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class PersonService : IPersonService
    {
        [WebInvoke(UriTemplate = "", Method = "GET")]
        public void GetPerson()
        {
            string k = "a";
        }
    }

 [ServiceContract]
    public interface IPersonService
    {
        [OperationContract]
        void GetPerson();

    }

 public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            RouteTable.Routes.Add(new ServiceRoute("api", new WebServiceHostFactory(), typeof(PersonService)));
        }
    }

I have some end points saved in database table like below :

/Customer/{Customer}/Address
/Customer/{Customer}/Address/{Address}

Now i want to populate routetable of my wcf service which will be hosted in IIS environment and is already running.

I have search alot on internet but couldnt find anything like such in which i can dyncamically add end points to routetable of wcf.

I will really appreciate if anybody have done anything like such and if they can post code/link that will help me.

Thank you :)

来源:https://stackoverflow.com/questions/43411673/populate-routetable-of-wcf-from-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!