更新时间:2022-10-25 09:59:34
在您的Solution Explorer中,打开你的 .SVC
通过使用查看标记,请确保您有是这样的:
... ServiceHost的语言=C#调试=真
服务=Yourservice.yourservicecodeBehind =yourservice.svc.cs%GT;
其中, Yourservice
是命名空间和 yourservice
是 .SVC 名称code>创建。
I get "Endpoint not found" when attempting to access my service via the browser at
http://localhost:10093/Services/Service1.svc
I get "Error: Cannot obtain Metadata from http://localhost:10093/Services/Service1.svc" when attempting to access the same address from the wcftestclient.
If I place a breakpoint in the service implementation it is hit, so I assume the svc file is setup correctly:
<%@ ServiceHost Language="C#" Debug="true"
Service="MyApp.Core.Service.Service.MyAppService,MyApp.Core.Service"
Factory="CommonServiceFactory.WebServiceHostFactory,CommonServiceFactory" %>
Here is my config:
<system.serviceModel>
<services>
<service name="MyApp.Core.Service.Service.MyAppService,MyApp.Core.Service"
behaviorConfiguration="MainServiceBehavior">
<endpoint name="newEndpoing"
binding="basicHttpBinding" bindingConfiguration=""
contract="MyApp.Core.Service.IMyAppService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MainServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
On your Solution Explorer, open your .svc
by using "view markup", make sure you have something like:
... ServiceHost Language="C#" Debug="true"
Service="Yourservice.yourservice" CodeBehind="yourservice.svc.cs" %>
Where Yourservice
is your namespace and yourservice
is name of your .svc
created.