1110
1110

Reputation: 6829

How to run WCF service in a dotnetnuke

I am trying to run WCF service under DNN.
I created a new WCF service web site project and set output to C:\inetpub\...\dotnetnuke\bin
I also removed web.config from that project.
Then I have created on console project and try to add service reference but I get the following error:

An error occured while attempting to find services at 'http://localhost:5847/MyService/Service.svc

I removed code from old web config to dnnweb config <system.serviceModel> but still don't work. What I want to do is to be able to access web service with url like

localhost/dotnetnuke/portal/mywebservice...

and not as default

localhost:XXXX/...

This is from my dotnetnuke web.config

<system.serviceModel>
    <services>
      <service name="Service" behaviorConfiguration="ServiceBehavior">        
        <endpoint address="localhost/dotnetnuke/service.svc" binding="wsHttpBinding" contract="IService">         
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">          
          <serviceMetadata httpGetEnabled="true"/>          
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

If I type full address in browser

http://localhost/dotnetnuke/desktopmodules/com.demo.service/service.svc

I get following error page:

The type 'Service', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

Upvotes: 0

Views: 1284

Answers (1)

ScottS
ScottS

Reputation: 8543

Even if you do get this to work, you will have nothing but trouble calling any of the DNN APIs as your request will not have the full DNN context.

A much easier solution is to use the Services Framework. It was released initially in 6.2 with and MVC2 based implementation, and will soon be updated in 7.0 with a WebAPI based implementation.

You can find several posts about using Services Framework here.

Upvotes: 3

Related Questions