これは、例外が発生するコードです。
public Listado()
{
InitializeComponent();
ListadoWebService();
}
public void ListadoWebService()
{
// InitializeComponent();
ServiceTours.ServiceToursClient cl = new ServiceTours.ServiceToursClient();
cl.ListadoCompleted += new EventHandler<ListadoCompletedEventArgs>(Listado2);
cl.ListadoAsync();
}
private void Listado2(object sender, ListadoCompletedEventArgs e)
{
listB.ItemsSource = e.Result; // listB is ListBox in WP8
}
次の例外が発生します。
An exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.ni.dll but was not handled in user code
MSDNのこのチュートリアルに直接従ったと言いたいです。
したがって、最終的なサービス リファレンスの URL は http:// IP /WcfTours/ServiceTours.svc です。//99.99.99 は IP を表します
World Wide Web Services (HTTP)
inAllow an app through Windows Firewall
はdomain
public
およびに使用できprivate
ます。
Virtual Directory
創造された。
誰かが設定を手伝ってくれませんendpoint
か?
例外メッセージ:
{System.InvalidOperationException: An endpoint configuration section for contract 'ServiceTours.IServiceTours' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory
1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) System.ServiceModel.EndpointTrait 1.CreateChannelFactoryRef 1.CreateSimplexFactory()
at System.ServiceModel.ClientBase
(EndpointTrait 1 endpointTrait)
at System.ServiceModel.ClientBase
1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase1..ctor()
at PhoneApp1.ServiceTours.ServiceToursClient..ctor()
at PhoneApp1.Listado.ListadoWebService()
at PhoneApp1.Listado..ctor()}