我在WCF Restful服务上遇到错误。
我正在传递网址= http://localhost:16679/SayHelloService.svc/SayHelloMessage
[ServiceContract]
public interface ISayHelloService
{
[OperationContract]
[WebInvoke(Method ="Get",
UriTemplate = "/SayHelloMessage",
RequestFormat =WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml,
BodyStyle =WebMessageBodyStyle.Wrapped)]
string SayHello();
}
public class SayHelloService : ISayHelloService
{
public string SayHello()
{
return "Hello! This is Hello Message From EBS Middleware Service App ";
}
}
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndPointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name ="HelloWorldService.SayHelloService" behaviorConfiguration="DefaultServiceBehavior">
<endpoint address="" contract="HelloWorldService.ISayHelloService" binding="webHttpBinding" behaviorConfiguration="EndPointBehavior"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>