我的控制台应用程序中有一个托管的 WCF 服务,如下所示:
static void Main(string[] args)
{
Uri baseAddress = new Uri("http://localhost:8080/Test");
// Create the ServiceHost.
using (ServiceHost host = new ServiceHost(typeof(TestService), baseAddress))
{
// Enable metadata publishing.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
host.Open();
Console.WriteLine("The Test service is ready at {0}", baseAddress);
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close the ServiceHost.
host.Close();
}
}
我在 Windows 应用商店 (WinRT) 应用程序中有一个客户端。我越来越
“(413请求实体太大”
尝试传递大字节数组时。如何MaxReceivedMessageSize
通过代码在我的服务中设置?