I have an issue with making a WCF call in Application_Start.
I need to do some one-time activities in Application_Start. For that, we make a WCF call on named pipe (as the WCF services are hosted in a separate server on local machine) in Application_Start. This works perfectly fine on IIS 6. But on IIS 7, it gives the following error...
[PipeException: The pipe name could not be obtained for the pipe URI: Access is denied. (5, 0x5)]
[AddressAccessDeniedException: The pipe name could not be obtained for net.pipe://localhost/PipeSQL.]
System.ServiceModel.Channels.PipeSharedMemory.Open(String sharedMemoryName, Uri pipeUri) +11200359
System.ServiceModel.Channels.PipeConnectionInitiator.GetPipeName(Uri uri) +265
This is how my Application_Start looks like...void Application_Start(object sender, EventArgs e)
{
System.ServiceModel.ChannelFactory<ISQLConnection> appServerInfoFactory = new System.ServiceModel.ChannelFactory<ISQLConnection>(new System.ServiceModel.NetNamedPipeBinding(),new System.ServiceModel.EndpointAddress(@"net.pipe://localhost/PipeSQL"));
ISQLConnection appServerInfoProxy = appServerInfoFactory.CreateChannel();
ServerInfo serverInfo = appServerInfoProxy.InfraServerInfo();
HttpRuntime.Cache["AdamServer"] = serverInfo.AdamServer;
}
Note: This WCF call works perfectly, if I move the call down to say Begin_Request event or say Page_Load event .