Мне нужно в рантами изменить адрес сервера. Делаю как ниже:
var baseAddress = new Uri(ArchiveStorage.Instance.Control.BaseAddress + "/StorageService");
var endPoint = new EndpointAddress(baseAddress);
var myBinding = new WSHttpBinding { Name = "WSHttpBinding_IArchiveStorageControl" };
Instance = new ArchiveStorageControlClient(myBinding, endPoint);
На чистых машинах работает корректно. На загруженных другими программами выползает ошибка ниже
2017-09-11 05:53:53.6497| Error | ArchiveStorageControlModel | Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))mscorlib
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Gramma.Storage.Console.Wpf.ArchiveControlServiceReference.IArchiveStorageControl.GetDrives()
at Gramma.Storage.Console.Wpf.ArchiveControlServiceReference.ArchiveStorageControlClient.GetDrives()
at Gramma.Storage.Console.Wpf.StorageClient.GetDrives()
at Gramma.Storage.Console.Wpf.ArchiveStorageControlModel..ctor() System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Amico.Sys.CDBurn.IDiscRecorder2.InitializeDiscRecorder(String recorderUniqueId)
at Amico.Sys.CDBurn.ImageBurn.GetSystemDevicesList()
at Amico.Sys.CDBurn.ImageBurn.get_SystemDevicesList()
at Gramma.Storage.ArchiveServer.ArchiveStorageControl.GetDrives()
at SyncInvokeGetDrives(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& r...).
Изначально service reference настроен на другой адрес-порт, затем и сервер и клиент при старте берут информацию о новом адресе и порте из конфиг файла.