问题
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