【发布时间】:2016-10-10 06:07:21
【问题描述】:
我需要在 app.config 文件中添加一些标签来实现 dll (xmlsoccer)。 我必须添加类似
的内容 <system.serviceModel>
<bindings>
<basicHttpBinding>
在一个配置节点中,但我不知道它在哪里。 我试图创建一个 app.config 文件并将 DotNetConfig.xsd 设置为方案,但在编译过程中,我有这个错误:
- 警告:无法为 * 加载端点配置
- SyStem.InvalidOperationException:必须为此通道工厂配置绑定
谁能帮帮我?
我试着写这个:
` 公共类 MainActivity : FormsApplicationActivity { public static readonly EndpointAddress EndPoint = new EndpointAddress("http://www.xmlsoccer.com/FootballDataDemo.asmx");
App application;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
// LoadApplication(new App(binding, EndPoint));
CreateBasicHttp();
LoadApplication(application);
}
private void CreateBasicHttp()
{
var binding = new BasicHttpBinding()
{
Name = "basicHttpBinding",
MaxReceivedMessageSize = 1000000,
};
binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
{
MaxArrayLength = 2147483646,
MaxStringContentLength = 5242880,
};
var timeout = new TimeSpan(0, 1, 0);
binding.SendTimeout = timeout;
binding.OpenTimeout = timeout;
binding.ReceiveTimeout = timeout;
application = new App(binding, new EndpointAddress("http://www.xmlsoccer.com/FootballDataDemo.asmx"));
}`
在我的 MainActivity.cs 中,但显然这还不够。
【问题讨论】:
-
Xamarin 移动应用不使用 app.config 文件。
-
完美 -_- 那么,有什么建议可以解决这个问题吗?
-
从您发布的内容来看,我不知道您在 app.config 中实际需要做什么。如果它只是可以通过编程方式完成的 WCF 服务的绑定。
-
我不能在这个范围内使用 AndroidManifest.xml 吗?
标签: binding configuration xamarin.forms app-config