我創建的Web服務庫想在這個環節http://www.codeproject.com/Articles/167159/How-to-create-a-JSON-WCF-RESTful-Service-in-60-sec有什麼不對的WCF
要發佈它,我跟着鏈接http://naztek.wordpress.com/2009/08/27/host-a-wcf-library-in-iis/
,但我在運行時得到這個錯誤
Server Error in '/WCFService1' Application.
The type 'Service', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The type 'Service', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
我web.config
是:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="test1.Try">
<endpoint address="http://localhost:8732/Try" binding="webHttpBinding" contract="test1.Try"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[InvalidOperationException: The type 'Service', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]
你可以解釋或更正我的代碼,我試圖設置所有限定名稱 – AMH
我擴展信息在我的答案。讓我看看你的Service.svc文件的內部。 –
非常感謝,但現在給出錯誤在服務'Try'實施的合同列表中找不到合同名稱'test1.Try'。任何想法如何解決你在web.config中的 – AMH