C# 主机WCF服务,500 System.ServiceModel.ServiceActivationException 我试图用SharePoint 2013基金会在WINDOWS Server 2012中托管WCF服务。< /P>
在我的服务中,我有这个接口C# 主机WCF服务,500 System.ServiceModel.ServiceActivationException 我试图用SharePoint 2013基金会在WINDOWS Server 2012中托管WCF服务。< /P>,c#,wcf,iis,sharepoint,C#,Wcf,Iis,Sharepoint,在我的服务中,我有这个接口 [ServiceContract(Namespace = "")] public interface ISharePointGappService { [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json
[ServiceContract(Namespace = "")]
public interface ISharePointGappService
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spGetAllUserResponse spGetAllUser();
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spGetAllUserResponse spGetUsers(spGetAllUserRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spListFilesResponse spListFiles(spListFilesRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spCreateUserResponse spCreateUser(spCreateUserRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spGetUserResponse spGetUser(spGetUserRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spDeleteUserResponse spDeleteUser(spDeleteUserRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spSearchFilesResponse spSearchFiles(spSearchFilesRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spDownloadFilesResponse spDownloadFiles(spDownloadFilesRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spGetFileResponse spGetFile(spGetFileRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spCreateFolderResponse spCreateFolder(spCreateFolderRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spDeleteFolderResponse spDeleteFolder(spDeleteFolderRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spUploadFileResponse spUploadFile(spUploadFileRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spDeleteFilesResponse spDeleteFiles(spDeleteFilesRequest request);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
spShareFileResponse spShareFile(spShareFileRequest request);
}
我的web.config是这样的
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
...
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="Mobilu.SharePoint2013Gapp.Services.SharePointGappService" >
<host>
<baseAddresses>
<add baseAddress="http://win-ricm5vnko1f/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="web" contract="Mobilu.SharePoint2013Gapp.Services.ServiceContract.ISharePointGappService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
如果使用WCF test client或Postman调用它们工作的方法,那么当我停止VisualStudio调试时,调用显然会停止工作,我希望在sharepoint上承载此任务并能够调用这些方法
当我发布我的项目时,我得到:
Mobilu.SharePoint2013Gapp.Services.SharePointGappService.svc
web.config
垃圾箱文件夹
然后我试着把它放在这里:
当我调用与VisualStudio调试时相同的方法(POST)时,我得到了这个错误
500 System.ServiceModel.ServiceActivationException
如果我试图直接用浏览器访问该文件,我会得到一个包含以下内容的页面
找不到作为ServiceHost指令中的服务属性值提供的或配置元素system.serviceModel/serviceHostingEnvironment/serviceActivations中提供的类型“Mobilu.SharePoint2013Gapp.Services.SharePointGappService”