对于具有webHttpBinding和helpEnabled ="true"的服务,将正确生成帮助信息.想知道是否有可能以某种方式控制输出.以下是我想做的更改.
我有一个对象层次结构,排列为Continents> Countries> Cities.能够选择特定"国家/地区"中的所有城市,如下所示.我正在寻找的是一种合并这两个查询的方法,并在单个查询中到达cityList.
var cities = network.Continents
.SelectMany(continent => continent.Countries)
.Where(ctry => ctry.Id == "country")
.SelectMany(ctry => ctry.Cities);
List<City> cityList = (from c in cities
select new City { Id = c.Id, Name = c.Name }).ToList<City>();
Run Code Online (Sandbox Code Playgroud)
"城市中的c"具有与cityList中的结构不同的结构,因此具有与第二查询中的映射不同的结构.
我用WCF服务创建了一个解决方案VS2010 C#,该库获取数据,该服务在解决方案中的控制台应用程序中运行良好.没问题.
对于旧项目,我必须在VS2008项目(以及稍后可能在VS2005上)上使用它.然后我启动VS2010我得到"WCF测试客户端".此时在VS2008中,我尝试在本地计算机上"添加Web引用"...没有结果.
然后我尝试使用Vs2010创建一个控制台应用程序来托管它,我这样做了:
Uri baseAddress = new Uri("http://localhost:8080/hello");
using (ServiceHost host = new ServiceHost(typeof(SecurityAccessWCF.WCFSecurityService), 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 service is ready at {0}", baseAddress);
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close the ServiceHost.
host.Close();
}
Run Code Online (Sandbox Code Playgroud)
我得到一个错误Open(),我收到此错误"AddressAccessDeniedException - HTTP无法注册URL ...您的进程没有访问权限"(提供的链接不清楚,我在Win7 x64上作为本地管理员和在域)
