我在使用basicHttpBinding运行的远程Windows VPS中托管了WCF Web服务C#。
问题是我通过远程桌面浏览到服务器计算机上的服务URL工作正常,但尝试使用外部IP地址(远程或本地EVEN)浏览不起作用。 (它向我显示浏览器消息"无法访问此站点")示例:
http://localhost:99/Service1.svc(好)
来自服务器远程桌面的http://8.35.36.82:99/Service1.svc(确定)
我的机器http://8.35.36.82:99/Service1.svc(不行)
我已在服务器防火墙中打开入站端口
任何想法??
的Web.config
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<services>
<service name="WebService.Service1">
<endpoint address="http://8.35.36.82:99/WebService/Service1.svc" binding="BasicHttpBinding" contract="WebService.IService1" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
</system.serviceModel>
答案 0 :(得分:0)
您可以简单地将其添加到您的配置中 - &gt;
<services>
<service name="WebService.Service1">
<endpoint address="" binding="BasicHttpBinding" contract="WebService.IService1" />
</service>
</services>
答案 1 :(得分:0)
我的解决方案
<system.serviceModel>
<standardEndpoints>
<webScriptEndpoint>
<standardEndpoint name="webScriptEndpoint0" crossDomainScriptAccessEnabled="true" />
</webScriptEndpoint>
</standardEndpoints>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding0">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="webHttpBinding0">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="debugServiceBehavior" name="Backend.CoreService">
<endpoint address="" behaviorConfiguration="webHttpRest" binding="webHttpBinding" bindingConfiguration="webHttpBinding0" name="Unsecure.Backend.CoreService" contract="Backend.ICoreService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webHttpRest">
<webHttp helpEnabled="true" automaticFormatSelectionEnabled="true" faultExceptionEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="debugServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="webHttpBinding" bindingConfiguration="basicHttpBinding0" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>