我收到这个错误,我不能动摇它。这个问题与
this SO
还有很多问题,更不用说页面本身了。
是的,我完全知道
namespace
和
service name
必须完全匹配。我现在读到了无数遍。
我有一个WCF服务库,我正在IIS中运行。服务器是Windows server 2016标准版。我改名了
App.config
到
Web.config
尽管我试着
App.config软件
. 我尝试了无数次的配置,但仍然是相同的错误。是的,我试着添加绑定和指定
basicHttpBinding
.
Web.Config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="MyTesterLibrary.MyTester" behaviorConfiguration="MetadataBehavior">
<endpoint address="" binding="wsHttpBinding" contract="MyTesterLibrary.IMyTester" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
主要类别
namespace MyTesterLibrary
{
public class MyTester : IMyTester
{
public string GetVersionInfo()
{
Backup.GetVersionInfo(out string response);
return response;
}
}
}
接口类
namespace MyTesterLibrary
{
[ServiceContract]
public interface IMyTester
{
[WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/GetVersionInfo")]
[OperationContract]
string GetVersionInfo();
}
}
产品服务主机.svc
<%@ ServiceHost Service="MyTesterLibrary.MyTester" %>
我按照另一个站点的说明创建了IIS站点。这张截图说明了一切。
我知道在引用的SO文章中,这个人坚持认为问题出在IIS中,而不是IIS,但我的问题似乎是这样的。我刚试过
基本绑定
同样的。
This question
在asp.net论坛上也很有趣。我本能地改名
App.config软件
到
Web.config配置
并重建了DLL。IIS不读取“App.config”。
思想?