bonjour ;
au cours du developpement de mon 1 er WCF j'ai eu cette exception(dans l'execution de la host qui va heberger le service) auquelle je me suis coincé .
Exception :
HTTP n'a pas pu inscrire l'URL
[ Lien ]. Le processus n'a pas de droits d'accès à cet espace de noms .
voici une copie ecran de ma solution:
voici le code de la host qui va heberger le service:
namespace Host
{
class
Program
{
static
void
Main(
string
[] args){
Uri
baseAdresse =
new
Uri
(
"http://localhost:2605/SolutionWCF/WCFLibrarie"
);
ServiceHost
monHost =
new
System.ServiceModel.
ServiceHost
(
typeof
(WCFLibrarie.
Class1
),baseAdresse);
try
{
monHost.AddServiceEndpoint(
typeof
(monPremierWCF.
interfaceWCF
),
new
WSHttpBinding
(),
"WCFLibrarie.Class1"
);
ServiceMetadataBehavior
smb =
new
ServiceMetadataBehavior
();smb.HttpGetEnabled =
true
;monHost.Description.Behaviors.Add(smb);
monHost.Open();
Console
.WriteLine(
"les services sont maintenant disponibles.............. "
);
Console
.WriteLine(
"Cliquer sur <ENTRER> pour fermer les services!!!"
);
Console
.WriteLine();
Console
.ReadLine();monHost.Close();
}
catch
(
CommunicationException
ex){
Console
.WriteLine(
"Une Exception est gener,e{0}"
, ex.Message);monHost.Abort();
}
}
}
}
le contrat :
namespace
monPremierWCF{
[System.ServiceModel.
ServiceContract]publicinterfaceinterfaceWCF{
[System.ServiceModel.
OperationContractAttribute]string majiscule(string chaine);[System.ServiceModel.
OperationContractAttribute]string mainiscule(string chaine);}
}
mon service :
namespace
WCFLibrarie{
publicclassClass1 : monPremierWCF.interfaceWCF{
#region
interfaceWCF Membersstring monPremierWCF.interfaceWCF.majiscule(string chaine){
returnstring.Format("hello {0}", "hicham").ToUpper();}
string monPremierWCF.interfaceWCF.mainiscule(string chaine){
returnstring.Format("hello {0}", "hicham").ToLower();}
#endregion
}
}
pour info je suis sur vista integral
Merci pour vos reponses!!!!!!!!!!!
Mettez du .net dans vootre vie