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.