.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

adding a service reference throws a contract error

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net
 

Hi

I added a service reference via the add service reference method. I can see all of its services in the intellisense but when I run the project and it executes the line where I instantiate the service : MyProjectName.ServiceReferenceName.IServiceReferenceClient  client = new  MyProjectName.ServiceReferenceName.ServiceReferenceClient;

it throws this error:

Could not find default endpoint element that references contract 'ServiceReferenceName.IServiceReferenceClient' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

 

Now this within my class library and I have added the service reference in my class library project.

Kind Regards

Ernst




View Complete Post


More Related Resource Links

Adding AJAX-enabled WCF Service to the Solution throws an error

  
Hi I am just trying to learn Ajax enabled WCF service, when I try to create a new web application and add new item "AJAX-enabled WCF Service" I get an error message that "The extension of type 'System.ServiceModel.Configuration.WebScriptEnablingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not registered in the extension collection 'behaviorExtensions'. I had .net2.0/VS2005 and then I installed VS2008. I thought it might be an issue with Machine.config. So I am attaching my machine.config info. <?xml version="1.0" encoding="UTF-8"?>    <!--    Please refer to machine.config.comments for a description and    the default values of each configuration section.     For a full documentation of the schema please refer to    http://go.microsoft.com/fwlink/?LinkId=42127     To improve performance, machine.config should contain only those    settings that differ from their defaults.    -->    <configuration>      <configSections>    <section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, Publi

Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che

  

A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

Invoking custom WCF service throws an Impersonation error from SQL

  
I've written a custom WCF service and hosted it in SharePoint. Accessing the MEX endpoint works fine. However, when I try to invoke the WCF service from my client code, I get the following error: 'A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)'. This exception gets thrown even before my WCF service gets invoked. Attaching a debugger, I see the following stack trace associated with the exception: 00000000`0c2dd7d0 000007fe`e7589b95 System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean)+0xd4 00000000`0c2dd810 000007fe`e7b7cd3b System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xf5 00000000`0c2dd870 000007fe`e758c4ee System_Data_ni!System.Data.SqlClient.TdsParserStateObject.WriteSni()+0x5f77ab 00000000`0c2dd8f0 000007fe`e758bf29 System_Data_ni!System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()+0xae 00000000`0c2dd950 000007fe`e757a1c7 System_Data_ni!System.Data.SqlClient.TdsParser.TdsExecuteRPC(System.Data.SqlClient._SqlRPC[], Int32, Boolean, System.Data.Sql.SqlNotificationRequest, System.Data.SqlClient.TdsParserStateObject, Boolean)+0x1189 00000000`0c2ddbf

Consume WCF Data service in client application throws error

  
Hi All, I am working on WCF Data service which imported stored procedure, as below.         [WebGet]         public List<GetMTSearchResultTest_Result> GettMTSearchResultTest()         {             MediaMarketResearch_PRODEntities ent = new MediaMarketResearch_PRODEntities();             return ent.GetMTSearchResultTest().ToList();         }   when i consuming this in my client application it says error as "The closed type MMRClient.MMRServiceReference.GetMTSearchResultTest_Result does not have a corresponding element settable property." I am getting this error while bind to the grid view as below. DataServiceContext context = new DataServiceContext(new Uri("http://localhost:4131/MMRDataService.svc/")); IEnumerable<GetMTSearchResultTest_Result> empResult = context.Execute<GetMTSearchResultTest_Result>(new Uri("http://localhost:4131/MMRDataService.svc/GettMTSearchResultTest"));             GridView1.DataSource = empResult;             GridView1.DataBind(); Note: I im

Consume WCF Data service in client application throws error

  
Hi All, I am working on WCF Data service which imported stored procedure, as below.         [WebGet]         public List<GetMTSearchResultTest_Result> GettMTSearchResultTest()         {             MediaMarketResearch_PRODEntities ent = new MediaMarketResearch_PRODEntities();             return ent.GetMTSearchResultTest().ToList();         }   when i consuming this in my client application it says error as "The closed type MMRClient.MMRServiceReference.GetMTSearchResultTest_Result does not have a corresponding element settable property." I am getting this error while bind to the grid view as below. DataServiceContext context = new DataServiceContext(new Uri("http://localhost:4131/MMRDataService.svc/")); IEnumerable<GetMTSearchResultTest_Result> empResult = context.Execute<GetMTSearchResultTest_Result>(new Uri("http://localhost:4131/MMRDataService.svc/GettMTSearchResultTest"));             GridView1.DataSource = empResult;             GridView1.DataBind(); Note: I im

Problem adding a Service Reference

  

Hello all.

I am developing a Web Application using Visual Studio 2010 in witch I have to add a Service Reference to http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl.

The problem is that my company's network requires a proxy authentication. So when I enter the "Add Service Reference" dialog, paste the url and click "go" I get a "(407) Proxy Authentication Required" error and cannot add the service.

I also tried using svcutil but the result, obviously, was the same.

How can I work around this? Is there somewhere I can specify the required proxy? Googling around, I found some comments that it can be specified in the Web.config, but I can't find more details on how to do this.

Thanks in advance.


Error while adding reference to latest version of AjaxControlToolkit

  

HI All,

I am a bit new to ASP.Net Ajax and as such new to Ajax itself. I have a site which uses ASP.Net Ajax.  It used the version AjaxControlToolkit version 3.0.30512.0. I have now changed it to version 3.5.40412.2 by deleting the old reference and adding a reference to the latest one . I build the soultion and everything appears fine witjhout any errors. But the site fails to load showing a yellow page with the message AjaxControlToolkit Version="3.5.40412.2" missing reference to 'AjaxControlToolkit.ExtenderBase.Base Scripts.js.BaseScripts.js'. What does this mean ?


Invoking custom WCF service throws an Impersonation error from SQL

  

I've written a custom WCF service and hosted it in SharePoint. Accessing the MEX endpoint works fine. However, when I try to invoke the WCF service from my client code, I get the following error:

'A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)'.

This exception gets thrown even before my WCF service gets invoked. Attaching a debugger, I see the following stack trace associated with the exception:

00000000`0c2dd7d0 000007fe`e7589b95 System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean)+0xd4
00000000`0c2dd810 000007fe`e7b7cd3b System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xf5
00000000`0c2dd870 000007fe`e758c4ee System_Data_ni!System.Data.SqlClient.TdsParserStateObject.WriteSni()+0x5f77ab
00000000`0c2dd8f0 000007fe`e758bf29 System_Data_ni!System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()+0xae
00000000`0c2dd950 000007fe`e757a1c7 System_Data_ni!System.Data.SqlClient.TdsParser.TdsExecuteRPC(System.Data.SqlClient._SqlRPC[], Int32, Boolean, System.Data.Sql.SqlNotificationRequest, System.Data.SqlClient.TdsParserState

On adding WCF Service reference element is not created

  

Hi Friends,

I am using x.509 certificate based authentication in my WCF service. In development stage, I created a x.509 certificate using makecert utility. Installed it on my local machine. Added the reference to the certificate in my WCF service. When I added the service reference to my Test App, following element got created in the app.config file of the Test App.

            <endpoint address="http://localhost/MyService/MyService.svc"
                binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint"
    contract="MyService.IMyService" name="wsHttpEndpoint">
                <identity>
                    <certificate encodedValue="Long encoded string..." />
                </identity>
            </endpoint>

I then deployed the WC

On adding WCF Service reference element is not created

  

Hi Friends,

I am using x.509 certificate based authentication in my WCF service. In development stage, I created a x.509 certificate using makecert utility. Installed it on my local machine. Added the reference to the certificate in my WCF service. When I added the service reference to my Test App, following element got created in the app.config file of the Test App.

            <endpoint address="http://localhost/MyService/MyService.svc"
                binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint"
    contract="MyService.IMyService" name="wsHttpEndpoint">
                <identity>
                    <certificate encodedValue="Long encoded string..." />
                </identity>
            </endpoint>

I then deployed the WC

Service Reference Error

  

I am getting this error:

There was an error downloading 'http://www.adrs.se/service/service1.svc'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://www.adrs.se/service/service1.svc'.
The remote server returned an unexpected response: (405) Method Not Allowed.
The remote server returned an error: (405) Method Not Allowed.
If the service is defined in the current solution, try building the solution and adding the service reference again.

There was an error

On adding WCF Service reference element is not created

  

Hi Friends,

I am using x.509 certificate based authentication in my WCF service. In development stage, I created a x.509 certificate using makecert utility. Installed it on my local machine. Added the reference to the certificate in my WCF service. When I added the service reference to my Test App, following element got created in the app.config file of the Test App.

            <endpoint address="http://localhost/MyService/MyService.svc"
                binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint"
    contract="MyService.IMyService" name="wsHttpEndpoint">
                <identity>
                    <certificate encodedValue="Long encoded string..." />
                </identity>
            </endpoi

no end point listening error while trying to get the service reference

  

Hey,

I am hosting a WCF service in WPF and trying to get the service reference in Console Application. I have tried to host the WCF (using the same code provided below) in a console application and it worked perfectly however when I try to host the service in WPF I am getting the following error:

Metadata contains a reference that cannot be resolved: 'net.pipe://localhost/'.

There was no endpoint listening at net.pipe://localhost/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

The pipe endpoint 'net.pipe://localhost/' could not be found on your local machine. 

If the service is defined in the current solution, try building the solution and adding the service reference again.

 

The way I host is:

    Dim _baseAddress As Uri

    Dim _netNamedBinding As NetNamedPipeBinding

     _netNamedBinding = New NetNamedPipeBinding()

     _netNamedBinding.CloseTimeout = New TimeSpan(1, 1, 1, 1, 1)

        Using host As New ServiceHost(GetType(PubSubService), _baseAddress)

            Try

          

Error adding a web reference...how do I fix this?

  

I am currently just trying to add a web reference to the app am trying to build and I keep getting an error each time I try to navigate to the URL (virtual directory) where I have my app locally...IIS.

The error that keeps popping up and I can't seem to get rid of this wrinkle...I am the admin on my personal machine, so I should have all permissions...which I do.

This is the error I keep getting. And here are what I have tried so far that has not resolved this

1) made sure that there were no duplicate accessType entries in the ApplicationHost.config and the web.config files

2) granted the READ permission to the IIS_IUSRS group for the ApplicationHost.config file

3) also granted the READ permission to the IIS_IUSRS group for the virtual directory

---this is on a Windows 7 machine with IIS 7. Please help...Thanks

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070005
Config Error Cannot

finding url to use when adding a service reference

  

I have sample code from stamps.com to access their SOAP style web services.  I would like to create a new project and add a service reference to it for the Stamps.com soap web service. How do I get the correct URL from the working project to use when adding the service reference to the new project?

I click properties of the web reference in the working stamps.com supplied project.  The web reference URL is https://swsim.testing.stamps.com/swsim/swsim-v4-wsdl.aspx

In another project, I click "add service reference", then paste that URL into the address line and click Go. Get back an error:
There was an error downloading 'https://swsim.testing.stamps.com/swsim/swsim-v4-wsdl.aspx'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'https://swsim.testing.stamps.com/swsim/swsim-v4-wsdl.aspx'.
There was no endpoint listening at https://swsim.testing.stamps.com/swsim/swsim-v4-wsdl.aspx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.

thanks,

 


while adding service reference in .net 2008

  

The document at the url https://hostname/app1/abc.svc was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'There was an error downloading 'https://internalsystemname/app1/abc.svc?disco'.'.
  - The request failed with HTTP status 502: Proxy Error ( No data record is available. For more information about this event, see ISA Server Help.  ).
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'https://hostname/app1/abc.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
The document at the url https://hostname/app1/abc.svc was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'There was an error downloading 'https://internalsystemname/app1/abc.svc?disco'.'.
  - The request failed with HTTP status 502: Proxy Error ( No data record is available. For more informatio

Problem while Adding reference of my Wcf Service

  

Hi

I have my wcf service hosted in the iis of the my development server.I am able to directly access the url of the service from both the server and the client browsers.I am also able to see the wsdl generated.

But when i add service reference from Visual studio 2008/2010,i get the following error..

The document at the url http://something.svc was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'http://something.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'DISCO Document' is 'There was an error downloading 'http://something.svc?disco'.'.

 - The request failed with HTTP status 503: Service Unavailable.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: 'http://something.svc'.

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

The remote server returned an error: (401) Unauthorized.

If the service is defined in the current 
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend