WCF&休息与休息指令集与指令集输出
我有两个问题,但我认为它们之间存在某种联系。
我使用 .NET4 创建了一个 WCF Rest 服务,并且仅在 https 上进行。在我的本地电脑上,一切正常。
现在我将其部署到托管提供商。据我所知,所有请求都通过 ISA 服务器。
起初,它不起作用。我尝试了很多,但总是收到错误 404,资源未找到。具体错误是:
[EndpointNotFoundException]: There was no channel actively listening at
'http://mydomainname/items/help'.
This is often caused by an incorrect address URI.
Ensure that the address to which the message is sent matches
an address on which a service is listening.
我首先看到的是异常中的 URL 不是 https。好吧,很奇怪,因为我的 web.config 是:
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<serviceAuthorization serviceAuthorizationManagerType="myNamespace.APIKeyAuthorization, myNamespace" />
</behavior>
</serviceBehaviors>
...
<webHttpBinding>
<binding name="">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
...
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" defaultOutgoingResponseFormat="Json">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</standardEndpoint>
</webHttpEndpoint>
所以我尝试了很多东西,但最后我让它工作了。我只是到处都写了一个名字。在行为标签中,绑定和标准端点标签。有用 !! 好吧,差不多了。 现在我的所有结果都是 XML 格式。我没有 json。即使使用带有“Accept:application/json”或“Accept:text/json”行的fiddler,它也始终是XML。即使我将automaticFormatSelectionEnabled设置为false。 并将“帮助”添加到 URL,例如“https://mydomainname/items/help”,我收到“未找到端点”
所以,现在我迷失了,因为我不理解 WCF 中的所有微小配置让一切顺利进行。 希望你能帮助我。
提前致谢。
M。
I got two questions, but I think that there linked in someways.
I made an WCF Rest service, with .NET4, and only on https. On my local pc, everything is ok.
Now I deployed it to a hosting provider. For what I know all the requests go through an ISA server.
At first, it didn't worked. I tried a lot, but I always got the error 404, resource not found. The specific error is :
[EndpointNotFoundException]: There was no channel actively listening at
'http://mydomainname/items/help'.
This is often caused by an incorrect address URI.
Ensure that the address to which the message is sent matches
an address on which a service is listening.
First thing I saw is that the URL in the exception is not https. OK, strange, because my web.config is :
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<serviceAuthorization serviceAuthorizationManagerType="myNamespace.APIKeyAuthorization, myNamespace" />
</behavior>
</serviceBehaviors>
...
<webHttpBinding>
<binding name="">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
...
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" defaultOutgoingResponseFormat="Json">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</standardEndpoint>
</webHttpEndpoint>
So I tried a lot of things but at the end I made it works. I just put a name everywhere. In the behavior tag, the binding and standardendpoint tag. IT WORKS !!
OK, almost.
Now all my results are in XML format. I got no json. Even with fiddler with the line "Accept: application/json" or "Accept: text/json" it always in XML. Even if I put the automaticFormatSelectionEnabled to false.
And adding the "Help" to the URL, like "https://mydomainname/items/help" I got a "Endpoint not found"
So, now I'm lost, as I don't understand all the tiny configuration in WCF to make everything work.
Hope you can help me.
Thanks in advance.
M.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我不知道这是否可以被认为是一个好的答案,但管理员在 ISA 服务器上做了一些事情。
所以现在它已经完全发挥作用了。
M。
OK, I don't know if it can be considered as the good answer but admin made something on ISA server.
So now it's fully working.
M.