我们有一个内部IIS Web服务器和一个外部IIS Web服务器。当我在两个服务器中发布使用Web服务的同一Web应用程序时,我收到一个错误,指出Webservice类未定义。
下面是我在ASPX页面中的代码
<asp:ScriptManager ID="sm_orderset" runat="server">
<Services>
<asp:ServiceReference Path="OrdersetService.svc" />
</Services>
</asp:ScriptManager>
这是JS中的呼叫
<script type="text/javascript">
//Ajax functions for retrieving and displaying comments
function getComments(componentid) {
OrdersetService.getComments(componentid, onSuccess);
}
</script>
对该函数的调用不执行任何操作。这是我在调试中找到的
SCRIPT:5009:“ OrdersetService”未定义
文件:jsfunctions.js,第8行,第5列
答案 0 :(得分:0)
发现问题是由于第二台服务器需要SSL绑定。更改了我在webconfig中的服务配置以获得结果。
这是我的webconfig的最终结果
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="Online_Power_Plan.OrdersetServiceAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="Online_Power_Plan.OrdersetService">
<endpoint address="" behaviorConfiguration="Online_Power_Plan.OrdersetServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="secureHttpBinding" contract="Online_Power_Plan.OrdersetService"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>