C# 使用WCF POST方法找不到方法
我的web.configC# 使用WCF POST方法找不到方法,c#,vb.net,wcf,wcf-binding,C#,Vb.net,Wcf,Wcf Binding,我的web.config Public Class Service1 Implements IService1 Public Function InsertData(name As String, surname As String) As String Implements IService1.InsertData ' Save name and surname which does work End Function End Class 如果导航
Public Class Service1
Implements IService1
Public Function InsertData(name As String, surname As String) As String Implements IService1.InsertData
' Save name and surname which does work
End Function
End Class
如果导航到,则使用上述配置
我明白了
错误“找不到方法”
当您通过浏览器执行此操作时,实际上是在执行GET请求,而您的方法不支持该请求
当你通过提琴手做这件事的时候,你会发一篇帖子
您可以使用该类或通过您的代码发布帖子。我可以通过任何文章/示例了解我需要做什么(我有点迷路了)?理想情况下,我希望创建URL来接受参数,然后保存到我的数据库中。谢谢,或者你是说我所说的是正确的,但是对于那些想使用URL的人来说,必须找到一种发布数据的方法,但是URL会自动保存传递到参数字段中的任何内容吗?@确切地说,在这种情况下,我认为只有客户如何使用它才是重要的。他们需要发出POST请求并在querystring中传入参数以访问您的方法。
Public Class Service1
Implements IService1
Public Function InsertData(name As String, surname As String) As String Implements IService1.InsertData
' Save name and surname which does work
End Function
End Class
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="WcfParameters.Service1">
<endpoint address="http://localhost:12345/Service1.svc" behaviorConfiguration="webHttpBinding"
binding="webHttpBinding" bindingConfiguration="" name="WebHttpw"
contract="WcfParameters.IService1" />
<!--<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />-->
</service>
</services>
<client>
<endpoint address="http://localhost:12345/Service1.svc" binding="webHttpBinding"
bindingConfiguration="" contract="WcfParameters.IService1" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<endpointBehaviors>
<behavior name="webHttpBinding">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<!--<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>-->
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>