简体   繁体   English

使用 Web 服务进行 DotNetNuke 模块开发

[英]DotNetNuke module development with webservices

I need to deploy a webservice as part of a DotNetNuke 4.x module that I'm creating - but am not sure how I can do that and know that it'll always stay in the same place.我需要将 web 服务部署为我正在创建的 DotNetNuke 4.x 模块的一部分 - 但我不确定我该如何做到这一点,并且知道它会始终保持在同一个地方。 How can I add an asmx file to my module project, and when I create my.DNN file specify where the webservice will end up?如何将 asmx 文件添加到我的模块项目中,并在创建 my.DNN 文件时指定 Web 服务的最终位置? I want to reference the webservice from inside the ascx file in the module using the "~/webservices/webservice.asmx" format.我想使用“~/webservices/webservice.asmx”格式从模块的 ascx 文件中引用 web 服务。

Does DotNetNuke have a way to specify in the.DNN file where the webservices will end up on the site? DotNetNuke 是否有办法在 .DNN 文件中指定 Web 服务最终在站点上的位置? And if so, will I still be able to reference them with root anchored tags like ~/myservice.asmx?如果是这样,我是否仍然可以使用 ~/myservice.asmx 之类的根锚定标签来引用它们?

You can include the ASMX file by including a element in the <files> section:您可以通过在<files>部分中包含一个元素来包含 ASMX 文件:

<files>
 <file>
  <name>YourWebService.asmx</name>
  <path></path>
 </file>
</files>

Generally, you don't need to specify a path.通常,您不需要指定路径。

Alternatively, you can include a Resources.zip file with your package which will include any files other than those that DNN needs to process during installation (eg Assemblies and SqlDataProvider files).或者,您可以在 package 中包含 Resources.zip 文件,该文件将包含 DNN 在安装期间需要处理的文件以外的任何文件(例如,程序集和 SqlDataProvider 文件)。

The benefit of this is maintainability.这样做的好处是可维护性。 Using Resources.zip will keep you from having to edit the manifest file over and over...使用 Resources.zip 将使您不必一遍又一遍地编辑清单文件......

The contents of the zip file will simply be unpacked into the root module directory (eg /DesktopModules/YourModule/*). zip 文件的内容将简单地解压缩到根模块目录(例如/DesktopModules/YourModule/*)。 If there is a file structure within your zip file it will be maintained.如果 zip 文件中有文件结构,它将被维护。

You'll want to add TheNameOfYourFile.zip To your manifest file under the element.您需要将 TheNameOfYourFile.zip 添加到清单文件中的元素下。

[snip]

<folder>
  <name>Your Module</name>
  <friendlyname>Your Module</friendlyname>
  <foldername>YourModule</foldername>
  <modulename>YourModule</modulename>
  <description>A module for DotNetNuke websites.</description>
  <version>01.00.00</version>
  <resourcefile>Resources.zip</resourcefile>
  <businesscontrollerclass></businesscontrollerclass>
  <modules>
    <module>

[/snip]

As for referencing it in your module - I suggest using:至于在您的模块中引用它 - 我建议使用:

<%=ResolveUrl("~/DesktopModules/YourModule/Services.asmx")%>

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

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