对于WCF来说,这是一个新手.我想我搞砸了一下.所以这就是我到目前为止所做的,我在IIS中托管了我的WCF服务
首先是合同
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using YangkeeServer.dto;
namespace YangkeeServer
{
public class Service1 : IService1
{
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "single")]
public YangkeeTrailerDTO getTrailor()
{
return new YangkeeTrailerDTO()
{
loanFrom = "heaven"
};
}
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "datum/{id}")]
public Test getName(string id)
{
return new Test()
{
Id = Convert.ToInt32(id) * 12,
Name = "Leo Messi"
};
}
}
} …Run Code Online (Sandbox Code Playgroud) 我在IIS 7.5中设置了一个MSCRM网站,其中我在绑定下配置了以下主机头:1)crm 2)crm.mydomain.com
我正在尝试访问OrganizationData.svc.我已配置将以下内容添加到CRMWeb应用程序的Web.config中
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://crm/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Run Code Online (Sandbox Code Playgroud)
如果我使用以下URL访问服务,则此方法有效:http://crm/MSCRMDEV/XRMServices/2011/OrganizationData.svc/ 但如果我使用FQDN http://crm.mydomain.com/MSCRMDEV/它不起作用XRMServices/2011/OrganizationData.svc /
我尝试在配置中添加" http://crm.mydomain.com/ "作为另一个前缀,就在我为" http:// crm / " 添加的条目下面,但是WCF会抛出以下错误:
此集合已包含方案http的地址.此集合中每个方案最多只能有一个地址.如果您的服务是在IIS中托管的,则可以通过将'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled'设置为true或指定'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'来解决问题.
我按照这里的建议添加了multiplesitebindings ="true",但这也没有帮助.我也查看了这个消息,但CRM Web应用程序的Web.config中没有节点,所以不确定我是否可以添加此部分
这可以实现吗?从我所看到的WCF有问题使用多个http主机头(在IIS绑定中添加).
我在sharepoint中使用了一个列表.有时当我尝试插入或编辑列表项时,sharepoint会以红色显示此错误:
sharepoint服务器此时无法保存表单.请再试一次
当我重新启动iis时,错误将消失,但我不能重复重启iis.我该如何解决这个错误.