还有另一个用于进行名为NancyFx的HTTP调用的框架.我的问题是使用它有什么好处.我快速查看了文档:
https://github.com/NancyFx/Nancy/wiki/Documentation
看起来没有突出的功能,因此我想使用它.通过WebHttp使用它有什么好处?
PS:我一直在读一些不断重复的"超级快乐路径"的奇怪短语.除了这种"超级快乐的道路"之外还有什么东西吗?实现了哪些真正的功能
我正在尝试将一个wcf webhttp服务部署到IIS上.我正在运行Windows 7,IIS 7.5,VS2010.
步骤 - 创建项目WCF休息服务应用程序. - 将项目发布到localhost - 确保应用程序池是.net 4.0
但是,当尝试通过http:// localhost/HelloRest访问在(Default Web Site/HelloRest)发布的服务时
它给出了一个错误 -
错误摘要 HTTP错误500.19 - 内部服务器错误此配置部分不能在此路径中使用.当该部分被锁定在父级别时会发生这种情况.锁定是默认情况下(overrideModeDefault ="Deny"),或由locationMode ="Deny"或遗留allowOverride ="false"的位置标记显式设置.
在配置源 模块中,突出显示runAllManagedModulesForAllRequests ="true"
有什么我想念的吗?当我从vs执行服务工作正常.在globals.asax我有 -
RouteTable.Routes.Add(new ServiceRoute("PrintHelloWorld", new WebServiceHostFactory(), typeof(HelloRestService)));
Run Code Online (Sandbox Code Playgroud)
从vs2010执行时 http:// localhost:59404/PrintHelloWorld / 返回hello world.但是,一旦发表
http:// localhost/HelloRest/PrintHelloWorld也返回相同的错误.
编辑 找出解决方案. - 我在安装.net框架后安装了IIS.在命令行中执行asp.net注册工具 - 转到Windows\Microsoft.NET\Framework\v4.0.30319中的目录aspnet_regiis.exe -ir
现在它开始起作用了.
我正在使用WCF .svc类,如下所示:
[DataContract] public class FunInfo { ... }
[OperationContract, WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
public FunInfo SetInformation(int a, int b) { ... }
Run Code Online (Sandbox Code Playgroud)
当我收回我的JSON时,它看起来像这样:
{"SetInformationResult":{ ... } }
Run Code Online (Sandbox Code Playgroud)
我的问题是:SetInformationResult来自哪里,我可以控制它的名字而无需重命名我的类吗?例如,要"d"模仿ScriptService的功能?
编辑:对于后代,我发现以后的相关链接:如何控制通用WCF返回类型的名称?
我有一个wcf webhttp服务,它使用表单身份验证来验证用户.如果票证来自cookie集合或URL,则此方法可以正常工作.
但是现在我想在自定义http标头中发送表单auth标签的字符串,并更改表单auth模块以检查该标头而不是cookie.
我认为将表单auth扩展到实现这一点应该很容易,但是找不到任何有关如何使用的资源.你能为我指出正确的方向吗 ?
这是我的身份验证流程如何工作,
我目前有一个带有webHttp绑定的WCF服务,我试图通过覆盖config中的默认设置来增加可以输入到服务的最大大小,我试过做类似的事情
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttp" >
<security mode="Transport">
<transport clientCredentialType =
"None"
proxyCredentialType="None"
realm="string" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="PrimeStreamInfoServices.Service1" behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" contract="PrimeStreamInfoServices.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PrimeStreamInfoServices.Service1Behavior">
<!-- To avoid disclosing metadata …Run Code Online (Sandbox Code Playgroud) 我有一个 WCF 服务托管在 Windows 服务中。我已经向它添加了一个具有 webHttp 行为的 webHttpBinding,每当我向它发送 GET 请求时,我都会得到 http 200,这正是我想要的,问题是每当我向它发送 HEAD 请求时,我都会得到一个 http 405。
有没有办法让它也为 HEAD 返回 http 200?这甚至可能吗?
编辑:那是操作合同:
[OperationContract]
[WebGet(UriTemplate = "MyUri")]
Stream MyContract();
Run Code Online (Sandbox Code Playgroud) 我目前有一个webHttp绑定WCF restful服务,它比http工作得很好,我可以根据我的webconfig设置制作大尺寸的帖子,现在我试图通过https(ssl)使用它,现在我的工作正常,但我的帖子不,当文件大小超过一定数量时它不起作用,我想知道为什么这可能是因为我的webconfig指定了更大的尺寸并且它在http上运行良好,这里是我的相关webconfig ..任何建议
谢谢
<system.serviceModel>
<client>
<endpoint binding="webHttpBinding" bindingConfiguration="webHttp"
contract="PrimeStreamInfoServices.IService1" name="Client" />
</client>
<bindings>
<webHttpBinding>
<binding name="webHttp" maxBufferSize="15000000" maxBufferPoolSize="15000000"
maxReceivedMessageSize="15000000">
<readerQuotas maxDepth="15000000" maxStringContentLength="10000000"
maxArrayLength="15000000" maxBytesPerRead="15000000" maxNameTableCharCount="10000000" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="string" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior"
name="PrimeStreamInfoServices.Service1">
<endpoint address="" binding="webHttpBinding"
bindingConfiguration="webHttp" contract="PrimeStreamInfoServices.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PrimeStreamInfoServices.Service1Behavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<!--
<serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="TempCa" />
-->
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<diagnostics> …Run Code Online (Sandbox Code Playgroud)