开发者

Can't Find WCF .svc Endpoints

开发者 https://www.devze.com 2023-01-22 11:10 出处:网络
locally I am not having any issues running a silverlight application. site comes up just fine. we deploy our code to our test environment and our site (or access to our data) stops working. I dont thi

locally I am not having any issues running a silverlight application. site comes up just fine. we deploy our code to our test environment and our site (or access to our data) stops working. I dont think our svc file is being recognized. I am leaning towards an issue with the endpoints. Im fairly new to wcf and service references. below is our code for the webconfig and the code for our clientconfig. wondering if anyone can give some direction onto what our issues may be.

our web.config

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior name="">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <customBinding>
      <binding name="AlgaeTrackerDataServices.customBinding0">
        <binaryMessageEncoding/>
        <httpTransport/>
      </binding>
    </customBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
         multipleSiteBindingsEnabled="true"/>
  <services>
     <service name="AlgaeTrackerDataServices">
        <endpoint address="" 
                  binding="customBinding" 
                  bindingConfiguration="AlgaeTrackerDataServices.customBinding0" 
                  contract="AlgaeTrackerDataServices">
        </endpoint>
        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange"/>
     </service>
   </services>
</sys开发者_StackOverflow中文版tem.serviceModel>

Our client config

 <system.serviceModel>
    <bindings>
        <customBinding>
            <binding name="CustomBinding_AlgaeTrackerDataServices">
                <binaryMessageEncoding />
                <httpTransport maxReceivedMessageSize="2147483647" 
                               maxBufferSize="2147483647" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:8080/AlgaeTrackerDataServices.svc"
                  binding="customBinding" 
                  bindingConfiguration="CustomBinding_AlgaeTrackerDataServices"
                  contract="AlgaeTrackerServices.AlgaeTrackerDataServices" 
                  name="CustomBinding_AlgaeTrackerDataServices" />
    </client>
</system.serviceModel>

Locally...when I click on the svc file and view in browser it comes up fine and I'm able to look at the wsdl. On our server I am unable to view the svc file..

I get an error that says that unable to launch asp.net develop...port 8080 is in use

Our event log says this..

WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/31852487 Exception: System.Web.HttpException (0x80004005): The service '/AlgaeTrackerDataServices.svc' does not exist. ---> System.ServiceModel.EndpointNotFoundException: The service '/AlgaeTrackerDataServices.svc' does not exist. at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) Process Name: w3wp Process ID: 13128

Thanks in advance for the help...


Using a SVC file and http transport would indicate you're probably hosting this WCF service in IIS, right??

In that case, the address of the service is determined by:

  • your server name
  • your server port (optionally)
  • the virtual directory (and possible subdirectories thereof) that your SVC file is contained in
  • the *.SVC itself

So from a "remote" client, an address would typically look something like:

http://(servername)/(virtual directory name)/YourService.svc

On a remote client, your service will definitely not be on localhost - that would be that client machine itself. You need to use the server name (or ip address) of the server that has the service on it. So all you need to do (most likely) is adapt the client's config to reference the server address / URL for the service instead of localhost. Also, unless you've specifically changed your IIS configuration, your service will be on port 80 - not 8080.


the fix was to add a relative path in the endpoints section.

instead of "http://localhost:8080/AlgaeTrackerDataServices.svc

this worked

"../AlgaeTrackerDataServices.svc


I actually had a similar problem, and the reason for the error in my case was that the Virtual Directory was located in a different subfolder than what was defined as "Home Directory" on the main website node. E.g.:

Home directory c:\Inetpub\wwwroot

Application path: c:\Apps\MyService

When I moved MyService to c:\Inetpub\wwwroot\MyService the problem went away.

Seems a bit strange that IIS asks you to browse the location of the service, when in reality it has to be a subfolder on the home directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消