![](/img/trans.png)
[英]Client can't find endpoint element of WCF Inside Windows Service
[英]Can't find WCF Endpoint for service
我目前正在向項目中添加WCF服務,但無法連接到該服務。 我還有另外兩種服務,它們的配置都可以正常工作,但是我找不到新的服務無法連接的原因。 當我嘗試連接到端點時,出現以下問題:
類型'MyProject.MyServices.MyService,MyProject,Version = 1.5.8.20715,Culture = neutral,PublicKeyToken = PUBLICKEY',作為ServiceHost指令中的Service屬性值提供,或在配置元素system.serviceModel / serviceHostingEnvironment / serviceActivations中提供找不到。
我嘗試將.svc中的Service屬性設置為其他兩個實現,並且它們工作正常。
myService.svc
<%@ServiceHost language="C#" Debug="true"
Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressDataServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=PUBLICKEYTOKEN"
Service="MyProject.MyServices.MyService, $SharePoint.Project.AssemblyFullName$" %>
MyService.cs
/// <inheritdoc />
//[SuppressMessage("Microsoft.Security", "CA2135", Justification = "Using Level 1 Security Rules as per Chuck's SP2016 Upgrade.")]
//[SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
//[SharePointPermission(SecurityAction.InheritanceDemand, ObjectModel = true)]
[BasicHttpBindingServiceMetadataExchangeEndpoint]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, IncludeExceptionDetailInFaults = true)]
[ServiceContract]
public class MyService : DataService<MyDataContext>
{
private SPWeb _web;
#region Constructor
/// <summary>
/// Default constructor
/// </summary>
public MyService() : base()
{
}
#endregion
#region Methods
/// <summary>
/// Method for handling the incoming request
/// </summary>
/// <param name="args">The arguments for the request</param>
override protected void OnStartProcessingRequest(ProcessRequestArgs args)
{
}
[OperationContract]
public string AddTwoNumbers()
{
return "I love WCF Services";
}
#endregion
}
我期望出現“找不到端點”,但是卻收到了上述的serviceActivations錯誤。
在我看來,WCF Web應用程序的不正確文件/目錄結構出了點問題,導致此問題,無法找到正確的文件。
有關詳細信息,請參閱以下鏈接。
https://social.msdn.microsoft.com/Forums/vstudio/zh-CN/4aab8a20-f39f-4c8d-aad2-8762ef87a66c/systemservicemodelservicehostingenvironmentserviceactivations-無法找到?forum = wcf
隨時讓我知道問題是否仍然存在。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.