Web服务没有被调用和崩溃

时间:2011-09-01 10:13:15

标签: c# android web-services xamarin.android

我是MonoDroid的新手,我在MonoTouch上开发了一个使用网络服务的应用程序,我正试图在Android上移植它。我在Mac上使用MonoDevelop(Mac OS X)。

我曾尝试从Xamarin(http://android.xamarin.com/index.php?title=Documentation/Guides/Consuming_Web_Services&file=58)运行“消费Web服务”教程,但它在我的2.2模拟器和HTC Legend设备上都不起作用。

当我点击按钮时,应用程序冻结3-4秒,我在状态栏上看不到任何网络活动,然后崩溃并关闭应用程序。

这是控制台跟踪:

I/MonoDroid( 1358): UNHANDLED EXCEPTION: System.InvalidOperationException: A Binding must be configured for this channel factory
I/MonoDroid( 1358): at System.ServiceModel.ChannelFactory.EnsureOpened () <0x000f0>
I/MonoDroid( 1358): at System.ServiceModel.ChannelFactory`1<TestWS.soatest.parasoft.com.ICalculator>.CreateChannel () <0x00013>
I/MonoDroid( 1358): at System.ServiceModel.ClientBase`1<TestWS.soatest.parasoft.com.ICalculator>.CreateChannel () <0x0001f>
I/MonoDroid( 1358): at System.ServiceModel.ClientBase`1<TestWS.soatest.parasoft.com.ICalculator>.get_InnerChannel () <0x00033>
I/MonoDroid( 1358): at System.ServiceModel.ClientBase`1<TestWS.soatest.parasoft.com.ICalculator>.get_Channel () <0x00013>
I/MonoDroid( 1358): at TestWS.soatest.parasoft.com.CalculatorClient.add (single,single) <0x0001b>
I/MonoDroid( 1358): at TestWS.ThreadDemo.button_Click (object,System.EventArgs) <0x0007f>
I/MonoDroid( 1358): at Android.Views.View/IOnClickListenerImplementor.OnClick (Android.Views.View) <0x0005f>
I/MonoDroid( 1358): at Android.Views.View/IOnClickListenerAdapter.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) <0x00063>
I/MonoDroid( 1358): at (wrapper dynamic-method) object.191f2c9a-a458-4c04-ae08-d2241fd3ff65 (intptr,intptr,intptr) <0x00033>
E/mono    ( 1358): 
E/mono    ( 1358): Unhandled Exception: System.InvalidOperationException: A Binding must be configured for this channel factory
E/mono    ( 1358):   at System.ServiceModel.ChannelFactory.EnsureOpened () [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at System.ServiceModel.ChannelFactory`1[TestWS.soatest.parasoft.com.ICalculator].CreateChannel () [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at System.ServiceModel.ClientBase`1[TestWS.soatest.parasoft.com.ICalculator].CreateChannel () [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at System.ServiceModel.ClientBase`1[TestWS.soatest.parasoft.com.ICalculator].get_InnerChannel () [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at System.ServiceModel.ClientBase`1[TestWS.soatest.parasoft.com.ICalculator].get_Channel () [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at TestWS.soatest.parasoft.com.CalculatorClient.add (Single x, Single y) [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at TestWS.ThreadDemo.button_Click (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 
E/mono    ( 1358):   at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.

(是的,它以Android结尾。我没有削减它)

有人可以帮我吗?

此致 C.Hamel

1 个答案:

答案 0 :(得分:0)

显然,这是因为当我不得不使用.NET 2.0时,我正在使用WCF实现Web服务。