WCF Services in ASP MVC PRoject (NopCommerce)

爷,独闯天下 提交于 2020-02-25 13:46:28

问题


I am trying to add a WCF Service to the Admin Folder of NopCommerce . I have done the same thing for the web folder and every thing goes Well, but for Admin folder when I try to execute I have this Error :

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. In the XML File here is the problem :< serviceHostingEnvironment multipleSiteBindingsEnabled="true">

I have tried several solutions but nothing works. Thanks in advance


回答1:


I just ran into this in one of our MVC projects, and it was due to having the MvcBuildViews property in the project file set to true. Setting the property to false fixed the problem.

<MvcBuildViews>false</MvcBuildViews>

EDIT: I also noticed this answer which outlines an alternative that does not require turning off view building.




回答2:


As I'm not sure what you have tried till now, this is my guess:

You virtual directory is not configured as an application, thus it is failed to execute as a service.

Configure this as an application.

Right click on the application directory in IIS and convert it to application. Also, assign right application pool to it.

See the below url for reference on how to configure a vir directory as an application in IIS7

http://msdn.microsoft.com/en-us/library/bb763173.aspx



来源:https://stackoverflow.com/questions/8247713/wcf-services-in-asp-mvc-project-nopcommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!