我真的很抱歉再次問這個問題。有類似的帖子,但沒有解決方案爲我工作。WCF服務無法啓動
我在VisualStudio2010中創建了一個新的WCF服務項目。它創建一個IService1.cs,Service1.svc和Service1.svc.cs
因此,當我嘗試調試/啓動服務時,出現以下錯誤。我正在運行Win7 x64。我正在使用集成的VisualStudio開發服務器(右鍵單擊項目 - >轉到頁面「Web」)。
類型「Projector.Service1」,作爲服務提供屬性值 在ServiceHost的指令,或者在配置元件 system.serviceModel/serviceHostingEnvironment/serviceActivations提供可以 不會被發現。
任何想法如何解決,而無需在IIS中運行它?
在此先感謝。
的Service1.svc只包含一個行:
<%@ ServiceHost Language="C#" Debug="true" Service="Projector.Service1" CodeBehind="Service1.svc.cs" %>
的Service1.svc.cs包含一個自動生成的類:
namespace Projector
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
public class Service1 : IService1
下面是在Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
你有沒有編譯錯誤? – CodeCaster
沒有編譯錯誤。 – Matthias
你可以發佈你的配置文件部分 .. system.serviceModel>嗎? –
vendettamit