Le serveur distant a retourné une erreur: NotFound
:salut:
J'en ai marre de m'arracher les cheveux depuis des jours et des jours sur cette erreur donc j'ai décidé de venir quémander un peu d'aide ici !
Je précise en préambule que le code était déjà écrit, je n'ai fait que reprendre le projet et je suis loin d'être un afficionados de Silverlight & consor.
J'ai une erreur lors de l'appel à un WCF :
Citation:
System.ServiceModel.CommunicationException: Le serveur distant a retourné une erreur*: NotFound. ---> System.Net.WebException: Le serveur distant a retourné une erreur*: NotFound. ---> System.Net.WebException: Le serveur distant a retourné une erreur*: NotFound.
à System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
à System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)
à System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
--- Fin de la trace de la pile d'exception interne ---
à System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
à System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
à System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- Fin de la trace de la pile d'exception interne ---
à System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
à System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
à System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
à xxx.Reporting.TracesServices.TracesClient.TracesClientChannel.EndTrace(IAsyncResult result)
J'ai collé des try/catch dans toutes les méthodes appelées en cascade depuis la première qui est censé m'envoyer ce que je veux :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| protected override void OnErrorUserAction(ExceptionEventArgs e)
{
base.OnErrorUserAction(e);
if (Members.ContainsKey(MembersName.Config))
{
PRMVVM.TraceError(Config, e,
(r) =>
{
Action show = () => { MessageBox.Show("Impossible de réaliser l'envoi, le service est indisponible", "Notification de l'erreur", MessageBoxButtons.OK); };
if (Dispatcher.CheckAccess())
show();
else
Dispatcher.BeginInvoke(show);
});
}
} |
Et je désespère je ne trouve pas d'où peut venir cette erreur Not Found... Et bien évidemment j'ai toujours à l'écran le message "Impossible de réaliser l'envoier, le service est indisponible"... Déjà je comprends pas tip top cette syntaxe avec le Action show() mais ça à la limite, ça passe.
Le service en question :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| namespace xxx.Reporting.Server
{
using Collections;
using Objects;
[ServiceContract(Namespace = "http://www.xxx.com")]
public interface ITraces
{
[FaultContract(typeof(ExceptionDetail))]
[OperationContract()]
bool Trace(Guid _customer, Guid _network, string _errorContent, string _method, eErrorState _state);
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| namespace xxx.Reporting.Server.Services
{
using Objects;
using Collections;
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Traces : ITraces
{
public bool Trace(Guid _customer, Guid _network, string _errorContent, string _method, eErrorState _state)
{
try
{
using (CommonManager cm = new CommonManager())
return cm.Trace(_customer, _network, _errorContent, _method, _state);
}
catch (Exception ex)
{
throw new FaultException<ExceptionDetail>(new ExceptionDetail(ex));
}
}
} |
J'ai tenté de rajouter le catch pour throw la FaultException, mais en vain, j'ai rien qui apparait.
Une question que je me pose quand même, au niveau du fichier ServiceReferences.ClientConfig j'ai ceci de référencé pour mon service :
Code:
1 2 3
| <endpoint address="http://localhost/xxx.Reporting.Main.Web/Traces.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITraces"
contract="TracesServices.ITraces" name="BasicHttpBinding_ITraces" /> |
Par contre au niveau du Reference.cs de la Service Reference j'ai ceci tout en haut :
Code:
1 2 3 4 5 6 7 8 9 10
| [System.ServiceModel.ServiceContractAttribute(Namespace = "http://www.xxx.com", ConfigurationName = "TracesServices.ITraces")]
public interface ITraces
{
[System.ServiceModel.OperationContractAttribute(AsyncPattern = true, Action = "http://www.xxx.com/ITraces/Trace", ReplyAction = "http://www.xxx.com/ITraces/TraceResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(System.ServiceModel.ExceptionDetail), Action = "http://www.xxx.com/ITraces/TraceExceptionDetailFault", Name = "ExceptionDetail", Namespace = "http://schemas.datacontract.org/2004/07/System.ServiceModel")]
System.IAsyncResult BeginTrace(System.Guid _customer, System.Guid _network, string _errorContent, string _method, eErrorState _state, System.AsyncCallback callback, object asyncState);
bool EndTrace(System.IAsyncResult result);
} |
Tout comme au niveau du namespace du service lui même (ITraces) où j'ai bien l'url de production.
Du coup est-ce que ça pourrait pas venir de là ? Et que du coup toutes les modifications de code pour catcher les exceptions que j'ai fait en local ben je les ai pas puisqu'il va chercher le service déployé en prod ?
Merci d'avance à tous pour votre aide !