C# apns sharp作为IIS中的wcf服务--不工作
我已经求助于使用apns sharp,虽然它在我的机器上作为控制台应用程序和基本的HTTPBinding WCF服务工作得很好,但通过wcftestclient测试,当我在IIS中托管WCF服务时,它不会给我任何启用SSL的错误 因为我使用monotouch进行开发,所以我使用slsvcutil构建了所需的类。我测试了几个异步调用,它们工作正常并返回正确的值。问题是,当我打电话发送推送通知时,我的应用程序崩溃 我像其他方法调用一样调用它,如下所示:C# apns sharp作为IIS中的wcf服务--不工作,c#,silverlight,xamarin.ios,apns-sharp,C#,Silverlight,Xamarin.ios,Apns Sharp,我已经求助于使用apns sharp,虽然它在我的机器上作为控制台应用程序和基本的HTTPBinding WCF服务工作得很好,但通过wcftestclient测试,当我在IIS中托管WCF服务时,它不会给我任何启用SSL的错误 因为我使用monotouch进行开发,所以我使用slsvcutil构建了所需的类。我测试了几个异步调用,它们工作正常并返回正确的值。问题是,当我打电话发送推送通知时,我的应用程序崩溃 我像其他方法调用一样调用它,如下所示: client.PushCompleted +
client.PushCompleted += HandlePushCompleted;
client.PushAsync();
void HandlePushCompleted (object sender, PushCompletedEventArgs e)
{
InvokeOnMainThread( delegate{
try
{
string value = e.Result.ToString();
}
catch(Exception ex)
{
Console.WriteLine("ERROR IS " + ex.InnerException);
Console.WriteLine("STACKTRACE IS " + ex.StackTrace);
}
} );
}
下面是错误和堆栈跟踪:
ERROR IS System.MissingMethodException: No constructor found for
System.ServiceModel.FaultException`1[[System.ServiceModel.Except ionDetail
, System.ServiceModel, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]]::.ctor(System.ServiceModel.ExceptionDetail,
System.ServiceModel.FaultReason, System.ServiceModel.FaultCode, (unknown))
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr,
System.Reflection.Binder binder, System.Object[] args,
System.Globalization.CultureInfo culture, System.Object[]
activationAttributes) [0x00174]
in /Developer/ MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299
at System.Activator.CreateInstance (System.Type type,
System.Object[] args, System.Object[] activationAttributes) [0x00000]
in /Developer/MonoTouch/Source/mono/mcs/class/corlib/ System/Activator.cs:234
at System.Activator.CreateInstance (System.Type type, System.Object[] args)
[0x00000] in
/Developer/MonoTouch/Source/ mono/mcs/class/corlib/System/Activator.cs:229
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Description.OperationDescription od,
System.Object[] parameters) [0x001a6] in
/Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel
/System.ServiceModel/ClientRuntimeChannel.cs:557 at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x00038] in
/Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel
/System.ServiceModel/ClientRuntimeChannel.cs:502 at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x0001c] in
/Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel
/System.ServiceModel/ClientRuntimeChannel.cs:479
STACKTRACE IS at
System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary ()
[0x0002d] in /Developer/MonoTouch/Source/mono/mcs/class/System
/System.ComponentModel/AsyncCompletedEventArgs.cs:54 at
PushCompletedEventArgs.get_Result () [0x00000] in
/Users/*/Desktop/App/Apps/proxy/Service.cs:273 at
ElectricityIOSApp.FirstViewController+c_AnonStorey1.<>m_2 ()
[0x00000] in /Users/*/Desktop/App/Apps/AppController.cs:519
非常感谢您的帮助。在我看来,服务器正在抛出错误,但在链接过程中,MonoTouch应用程序中删除了FaultException的构造函数。模拟器中发生了什么?相同的?“我会将服务器端消息包装在一个try-catch中,看看您是否可以将真正的错误返回给客户端。”乔纳森。最后我编写了一个控制台测试客户端,并从上面的web服务调用了push方法。原来它在错误的位置查找p12文件。我更正了路径,但是现在它显示它实际上没有发送。我又回到月亮上。测试和工作。我想知道为什么安夏普不发送。