Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Adding a self hosted wcf service in a moduleAdding a self hosted wcf service in a module
Previous
 
Next
New Post
1/15/2014 1:34 PM
 

Hi All.

 I would like to use a wcf self hosted service. The svc file won't load though. I am using the www.dnndev.me on my development computer.

So far I have this in my web.config file...

<system.serviceModel>
    <behaviors>
      
      <serviceBehaviors>
        <behavior name="WebApplication1.Service1AspNetAjaxBehavior" >
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
      
      <endpointBehaviors>
        <behavior name="WebApplication1.Service1AspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>

    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="WebApplication1.Service1">
        <endpoint address="" behaviorConfiguration="WebApplication1.Service1AspNetAjaxBehavior"
          binding="webHttpBinding" contract="WebApplication1.Service1" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
      
    </services>
  </system.serviceModel>

...In my module I have in the load event...

Dim sm As ScriptManager = AJAX.GetScriptManager(Me.Page)
sm.Services.Add(New ServiceReference("~/svc/Service1.svc"))  ' which is the correct location

...the WebApplication1.dll is in the bin directory of the site. (WebApplication1 is the project I created my service in). My svc.vb file code is...

Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web

<ServiceContract(Namespace:="")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class Service1

    ' To use HTTP GET, add <WebGet()> attribute. (Default ResponseFormat is WebMessageFormat.Json)
    ' To create an operation that returns XML,
    '     add <WebGet(ResponseFormat:=WebMessageFormat.Xml)>,
    '     and include the following line in the operation body:
    '         WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml"
    <OperationContract()>
    Public Sub DoWork()
        ' Add your operation implementation here
    End Sub

    ' Add more operations here and mark them with <OperationContract()>
    <OperationContract()>
    Public Function ComeOnThen() As String()
        Dim strResult(2) As String

        strResult(0) = "It worked! " & Now.ToString

        Return strResult
    End Function

End Class

I go to ViewPageSource from Firefox and click on the link...

<script src="svc/Service1.svc/js" type="text/javascript"></script>

...and it takes me to the 404 Page not found.

I have tested it in WebApplication1 project and it works so I don't know why it is not loading.

Thank you for your help.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Adding a self hosted wcf service in a moduleAdding a self hosted wcf service in a module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out