我知道有关该错误的问题存在很多疑问,但我无法摆脱它。
当我在导航器中编写地址时,它的工作正常,但是当我在WPF应用程序中调用相同的方法时,我遇到了404错误。
这是我的WPF应用程序的服务模式:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="webEndpoint">
<webHttp defaultBodyStyle="Wrapped"
defaultOutgoingResponseFormat="Xml"
helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttp">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<client>
<endpoint binding="webHttpBinding"
bindingConfiguration="webHttp"
behaviorConfiguration="webEndpoint"
contract="ServiceReferenceBX.IServiceBX"
address="http://localhost:9804/ServiceBX.svc">
</endpoint>
</client>
</system.serviceModel>`
这是我的WCF的web.config
`<?xml version="1.0" encoding="utf-8"?>
<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>
<services>
<service name="BXSportWCFLib.ServiceBX" behaviorConfiguration="ServiceBehaviour">
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="webHttpBinding" contract="BXSportWCFLib.IServiceBX" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>`
这是我的合同
[ServiceContract]
public interface IServiceBX
{
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest,
UriTemplate = "ListExercices/{guidUser}")]
List<Exercice> getListExercices(string guidUser);
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
Exercice AddNewExercice(string guidUser,string nom,bool nbRepetition, bool Poids, bool Distance, bool Duree);
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest,
UriTemplate = "ListeFen/{guidUser}")]
List<Fenetre> getFenetres(string guidUser);
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest,
UriTemplate = "Connect/{login}/{mdpCrypt}")]
string UserConnect(string login, string mdpCrypt);
}
我使用UserConnect方法进行了测试。
提前非常感谢。
答案 0 :(得分:0)
我的app.config
.col:nth-of-type(1) {
top: 0px;
left:0px;
}
.content {
display: none;
}
.navigation ul li a:hover + .content {
display: block;
position: absolute;
left:0px;
top: 0px;
}
这是我的web.config:
<div class="col">
</div>
<div class="col">
<div class="navigation">
<ul>
<li><a href="#">punkt</a>
<div class="content">lorem ipsum</div>
</li>
</ul>
</div>
</div>
这是我的合同:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="BXSportCL.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="soap"
maxReceivedMessageSize="1116553600"
maxBufferPoolSize="1116553600"
maxBufferSize="1116553600"/>
</basicHttpBinding>
<wsHttpBinding>
<binding name="mex" maxReceivedMessageSize="1116553600"
maxBufferPoolSize="1116553600">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:9804/ServiceBX.svc/soap"
binding="basicHttpBinding" bindingConfiguration="soap" contract="ServiceReferenceBX.ServiceBX"
name="soap" />
</client>
</system.serviceModel>
<applicationSettings>
<BXSportCL.Properties.Settings>
<setting name="DebugMode" serializeAs="String">
<value>True</value>
</setting>
</BXSportCL.Properties.Settings>
</applicationSettings>
</configuration>