问题标签 [wcf-rest]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1010 浏览

wcf - WCF 休息客户端 - 发布超时

我是 WCF 休息的新手。我有两个操作合同,一个 POST 和一个 GET 方法。在我的客户端中,我使用 HttpWebRequest 并尝试访问操作合同。

每当我访问 POST 方法操作合同时,我都会收到超时错误。但是当我在成功的 GET 方法后尝试访问 POST 方法时,一切正常。

是否有必要,我应该在 POST 方法调用之后使用 GET 方法调用?

我在这里做错了什么?

0 投票
2 回答
3462 浏览

wcf - wcf restful service method invoke error for http post

I have a simple restful wcf service which I have created just for fun. I tried the invoke the post method but I am failling. here is the summary;

this is my service contract interface;

this is the data members of my service which is Category2 Class;

this is the code which I am trying to invoke the post method;

and this is the xml file that I am using to send which is category.xml;

when I run the code, I am getting the following error as soon as I try to _WebRequest.GetResponse() call;

The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml'; 'Json'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.

I also tried to post it with fiddler with request builder function of it and I got the same error as well.

So what I am missing here guys?

0 投票
1 回答
377 浏览

wcf - 更改 IparameterInspector WCF RESTful 中的参数值

我试图在进行验证时更改 IParameterInspector 中参数的值。字符串参数可以正常工作。但我需要 int 作为参数。如果在 RESTful 调用中没有提供参数,我需要默认它。

如果 url 不包含任何 int 参数,则失败。但是,在字符串参数的相同情况下,如果未提供,则采用默认值。

我使用查询字符串格式来传递参数。我只是想在浏览器上运行它。

有什么办法可以做到这一点吗?还是我需要将所有参数都设为字符串。

提前致谢!

0 投票
0 回答
1393 浏览

wcf - 使用 wcf restful 服务时禁止:403 错误

我正在尝试使用 wcf 宁静的服务。代码如下:

现在的问题是,有时它工作正常,有时我得到错误

我无法弄清楚它为什么会失败。任何想法???

0 投票
1 回答
313 浏览

c# - WCF Restful 服务 - 图像未显示

我有一个宁静的网络服务(WCF Rest 服务模板 4.0 C# - VS 2010)。该服务运行得很好,但是如果我想在浏览器中显示图像,它位于 webservices 的根目录中,我什么也看不到...

如果项目在本地主机上运行,​​没关系...

0 投票
1 回答
1128 浏览

wcf-rest - WCF 休息安全问题

我有一个 WCF REST 服务。现在的问题是如何保护我的 REST 服务,以便没有人可以使用/调用它?以及调用它的最佳方式是什么(例如使用jquery,或从后面的代码)?客户端应用程序位于 MVC 3 上。

请帮助和建议

非常感谢

0 投票
1 回答
2376 浏览

wcf - WCF REST Starter Kit 不再是继续创建 Restful 服务的方法了吗?

也许这个问题太蹩脚了,但这件事让我很困惑。http://msdn.microsoft.com/en-us/netframework/wcf-screencasts上有一个截屏视频系列,并且在那里使用了 WCF 入门工具包。

但是该项目是在 .net 3.5 上完成的,现在我很想在 .net 4 上创建我的宁静 wcf 服务。当我安装 wcf 入门工具包时,项目模板不在 VS 2010 的项目列表中。所以,我应该在我的 .net 项目上使用 wcf starter kit dll 文件吗?

我现在正在做的方式是将来自 wcf 入门工具包的引用手动添加到我的项目中。

谢谢。

0 投票
1 回答
1073 浏览

asp.net - 在 Windows Server 2003 上托管 WCF Web Serveic

出现以下错误...

“/”应用程序中的服务器错误。IIS 指定身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持指定一个身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便只使用一个身份验证方案。说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.InvalidOperationException:IIS 指定身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持指定一种身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便只使用一个身份验证方案。

源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

[InvalidOperationException:IIS 指定了身份验证方案'IntegratedWindowsAuthentication,匿名',但绑定只支持指定一个身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便仅使用一个身份验证方案。] System.ServiceModel.Web.WebServiceHost.SetBindingCredentialBasedOnHostedEnvironment(ServiceEndpoint serviceEndpoint, AuthenticationSchemes supportedSchemes) +446264
System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary`2implementedContracts , 字符串multipleContractsErrorMessage) +709
System.ServiceModel.Web.WebServiceHost.OnOpening() +203 Microsoft.ServiceModel.Web.WebServiceHost2.OnOpening() 在 e:\bt\3781\Microsoft.ServiceModel.Web\Microsoft.ServiceModel.Web\WebServiceHost2.cs:69 系统.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +229
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +121
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479

[ServiceActivationException:服务“/Service.svc”由于编译过程中的异常而无法激活。异常消息是:IIS 指定身份验证方案'IntegratedWindowsAuthentication,匿名',但绑定只支持指定一个身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便仅使用一个身份验证方案..]
System.ServiceModel.AsyncResult.End(IAsyncResult result) +11599786
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
System.ServiceModel.Activation。 HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
+278 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously ) +75

版本信息:Microsoft .NET Framework 版本:2.0.50727.3615;ASP.NET 版本:2.0.50727.3618

0 投票
1 回答
1607 浏览

asp.net - 2003 年使用 POST / JSON 托管 WCF Rest 服务

当我在 Win 2003 服务器上托管 WCF 服务时遇到问题。因为它在我的本地 PC 上运行良好。

如果我需要在 Web Config 中进行任何更改,请现在告诉我。文件。对于相同的。

“/”应用程序中的服务器错误。 IIS 指定身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持指定一个身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便只使用一个身份验证方案。说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.InvalidOperationException:IIS 指定身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持指定一种身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便只使用一个身份验证方案。

源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

0 投票
3 回答
471 浏览

wcf - 为什么在 ASP.NET MVC 中有 JsonResult 时使用 WCF REST?

我正在构建一个 ASP.NET MVC 应用程序,并且仍然认为自己是 ASP.NET MVC 的新手。我来自 WCF REST 背景,所以我最初设置了一些服务,我的基于 jQuery 的客户端将通过 RESTful AJAX 请求调用这些服务。随着我对 ASP.NET MVC 的了解更多,我发现了 JsonResult ActionResult 类型,我可以将这些方法添加到控制器中,它的行为就像我的 WCF RESTful 服务一样。

所以我的问题是,我没有看到 WCF RESTful 服务提供的 JsonResults 是否存在限制?到目前为止,我还没有看到它,我想知道这是否完全消除了我对 WCF REST 功能的需求。

提前致谢!