简体   繁体   English

具有不同外部端口的Web服务(asmx)导致调用错误

[英]Web Service (asmx) with different external port causing error on invoke

previously we have webservice (asmx) located at our main server with external port 80 and was able to invoke the webservice correctly 以前我们的Web服务(asmx)位于我们的主服务器上,具有外部端口80,并且能够正确调用该Web服务

now we rellocate it to another server with external port 208. we are able to call the page just fine. 现在,我们将其重新分配到具有外部端口208的另一台服务器。我们可以很好地调用该页面。 But on invoke it returns 但是在调用时它返回

Server Error in '/' Application. “ /”应用程序中的服务器错误。 The resource cannot be found. 无法找到该资源。

Url of web service http://X11.XX5.XX3.X35:208/SB_MWS/SB_MWS.asmx?op=CheckUser Web服务的 网址http://X11.XX5.XX3.X35:208 / SB_MWS / SB_MWS.asmx?op = CheckUser

Response URL on Invoke http://X11.XX5.XX3.X35/SB_MWS/SB_MWS.asmx/CheckUser 调用 http://X11.XX5.XX3.X35/SB_MWS/SB_MWS.asmx/CheckUser的 响应URL

Notice that the response URL no longer points to 208 thus giving the error. 请注意,响应URL不再指向208,从而给出了错误。 What setting do i have to set to enable this port? 我必须设置什么设置才能启用此端口?

One reason this could occur is if you don't have a start page set under your web project's properties. 发生这种情况的一个原因是,如果在Web项目的属性下没有设置起始页。 So do this: 这样做:

Right click on your project 右键点击您的项目

Choose "Properties" 选择“属性”

Select the "Web" tab 选择“网页”标签

Select "Specific Page" 选择“特定页面”

Assuming you have a controller called HomeController and an action method called Index, enter "home/index" in to the text box corresponding to the "Specific Page" radio button. 假设您有一个名为HomeController的控制器和一个名为Index的操作方法,请在与“特定页面”单选按钮相对应的文本框中输入“ home / index”。

Now, if you launch your web application, it will take you to the view rendered by the HomeController's Index action method. 现在,如果您启动Web应用程序,它将带您进入HomeController的Index操作方法呈现的视图。

(or) (要么)

Simply, you could also open one of the controllers in your project and then hit on F5 or Ctrl + F5. 简单来说,您也可以打开项目中的一个控制器,然后按F5或Ctrl + F5。

What's happening now is that, you are currently in your /Views/home/Index.cshtml view and you just hit on F5 or Ctrl + F5. 现在发生的事情是,您当前在/Views/home/Index.cshtml视图中,并且只按了F5或Ctrl + F5。 In an mvc project, you cannot open a file w/ .cshtml extension directly as IIS cannot understand that. 在mvc项目中,您无法直接打开带有w/ .cshtml扩展名的文件,因为IIS无法理解。 The controller is supposed to return a matching view from within the action method. 控制器应该从action方法中返回匹配的视图。

If my answer doesn't help, I am sorry. 如果我的回答没有帮助,对不起。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM