- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
经过几个小时的示例搜索后,其中大部分只包含方法片段而不是“全貌”,我正在寻求指导。从开箱即用的 web.config Visual Studio 使用新的 WCF 服务创建开始,我编写了我的基本 Web 服务。当您在调试中运行时,WCF 测试客户端会显示您可以测试的函数。这很棒。现在,想要将代码移动到 IIS(首先在我的本地计算机上,然后在使用 SSL 的 Web 服务器旁边),我添加了一些我在 Web 上找到的代码。我确实让我的配置在某一时刻工作,但设法对其进行了太多更改,以至于我丢失了原始配置。所以,我有这个:
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="webHttpBinding"/>
</protocolMapping>
<services>
<service name="TaskTrackerAppService.Service1" behaviorConfiguration="">
<endpoint address=""
binding="webHttpBinding"
contract="TaskTrackerAppService.IAppWebService"
behaviorConfiguration="WebBehavior"></endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" bindingConfiguration=""></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="TaskTrackerAppService.IAppWebService"></binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="" binding="webHttpBinding"
bindingConfiguration="TaskTrackerAppService.IAppWebService"
contract="TaskTrackerAppService.IAppWebService"></endpoint>
</client>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</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>
我将客户端桌面应用程序服务引用配置为指向本地 IP http:192.168.0.100:90/AppWebService.svc。然后,当我运行我的客户端应用程序时,出现错误:
Could not find default endpoint element that references contract 'ServiceReference.IAppWebService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
所以我想更正 web.config 设置。然后部署到 SSL 已准备就绪的托管 IIS 服务。作为奖励,有没有办法配置端点,这样我仍然可以运行调试器并获取 WCF 测试客户端。在曾经工作的配置中,WCF 测试停止工作。它可以同时支持简单配置和托管配置吗?
谢谢。
最佳答案
<client>
<system.serviceModel>
部分由客户端应用程序用来指定 "ABC" properties服务端点的(地址、绑定(bind)和契约(Contract))。您的桌面应用程序中应该有该部分,以便您可以简单地将其从服务器配置中删除。
<client>
但是,桌面应用程序的 app.config 部分应该具有与服务端点相同的“ABC”属性。由于您的服务绑定(bind)是 webHttpBinding
客户端还应该有 webHttpBinding
作为绑定(bind),但我可以看到它指的是 bindingConfiguration,TaskTrackerAppService.IAppWebService
实际上是一个 basicHttpBinding
所以这是一个错误配置。
此外,由于您的生产环境正在使用 SSL,因此您的生产 web.config 应该具有类似于以下内容的 SSL 绑定(bind)配置:
<bindings>
<webHttpBinding>
<binding name="webBindingHTTPS">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
具有以下端点配置:
<endpoint address=""
binding="webHttpBinding"
contract="TaskTrackerAppService.IAppWebService"
behaviorConfiguration="webBindingHTTPS"></endpoint>
实现此目的的最佳方法是使用 web.config transformation syntax .在这种情况下,您的 Release web.config 可能包含以下元素:
<bindings>
<webHttpBinding>
<binding name="webBindingHTTPS" xdt:Transform="Insert">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<endpoint address="" xdt:Transform="Replace" xdt:Locator="Match(name)"
binding="webHttpBinding"
contract="TaskTrackerAppService.IAppWebService"
behaviorConfiguration="webBindingHTTPS">
</endpoint>
这样,只要您的项目是在 Debug 模式下构建的,它将被配置为不使用 SSL,而无论何时在 Release 模式下构建,它将使用 SSL。
关于IIS 托管和 SSL 的 WCF web.config 文件设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49665815/
我会尝试尽可能详细地描述我的问题,但如果需要更详细的解释,请告诉我。 为了简化,假设我有 3 个 DLL(实际上我有更多,但我猜这不是很重要): managed-1.dll - 托管 DLL(用 C#
我有一个 Tomcat 6 JSF Web 应用程序,我想使用 CDI bean 来设置它。不过,我必须逐渐将项目转换为 CDI。 我的问题是:CDI bean 和传统的 JSF 托管 bean 可以
我计划将 Web 应用程序从使用 JSF 托管 Bean 转换为使用 CDI 托管 Bean。我知道我需要执行以下操作: 在 WEB-INF 中添加一个空 beans.xml 文件。 将所有 JSF
我在裸域上运行我的解析应用程序。 Parse 并没有让我的生活变得轻松。 起初我很难设置它,因为大多数 DNS 托管服务不允许根域上的 CNAME,而 Parse 需要 CNAME。 决定尝试使用 C
如果您使用 Firebase 托管 将请求定向到 云函数 通过重写,“通过”托管的请求流量是否会记入 Firebase 托管 国标转出 ? (忽略 Cloud Function 的计费) 换句话说,
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
我有一个特定的用例,我正尝试使用 Firebase 托管来解决,它如下: 我正在使用 Gridsome 生成静态网站 在构建之前,Gridsome 使用 Graphql 并从 Headless CMS
您好,我有一个blazor页面,我想在其中显示一个变量。 这个变量从另一个线程(通过Websocket接收数据的另一个线程)获取更新,我想以线程安全的方式显示它: Blazor页面 @page "/n
我想使用 Firebase 托管来托管一个 angular 应用程序,我需要创建一个重定向到另一个 URL 中的一些旧文件。 根据 Firebase 文档,您可以进行基本重定向 "redirects"
我正在尝试找出满足电子学习平台以下要求的最佳方法。 我在其中编辑视频的后端,以便可以将它们彼此链接(例如youtube-comment函数) 用户只能在访问平台时观看视频(不允许下载!) 视频只能通过
已关闭。这个问题是 not about programming or software development 。目前不接受答案。 这个问题似乎不是关于 a specific programming
我想这是一个相当深入的主题,因此任何带有洞察信息的网址也很乐意接受。我一直在使用原生 DirectX,但从未管理过。另一方面,大多数情况下,在开发不需要高级 GPU 渲染的其他类型的应用程序时,我通常
我刚刚将一个网站部署到 Firebase 托管,效果非常好 - 设置非常简单。 但是,我的问题是,有什么方法可以使访问该网站受到身份验证的限制吗?这是一个管理面板,只有我的团队才能访问。有什么方法可以
已关闭。这个问题是 not about programming or software development 。目前不接受答案。 这个问题似乎不是关于 a specific programming
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找书籍、工具、软件库、教程或其他场外资源的问题对于 Stack Overflow 来说是
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 6 年前。
我刚刚将一个网站部署到 Firebase 托管,它运行良好 - 设置非常简单。 但是,我的问题是,有什么方法可以通过身份验证限制对网站的访问?这是一个只有我的团队才能访问的管理面板。有什么方法可以用密
如果我想托管一个对公众用处不大的应用程序(例如,一个将点打印到控制台的程序,它们的数量取决于现在的时间),我喜欢在启动板中的方式不必乱扔全局托管站点的命名空间并用诸如 HourDot 之类的名称填充它
我是一名优秀的程序员,十分优秀!