WCF and MySQL Connector - c#

I created a WCF service. It uses MySQL Connector to connect to a MySQL Database. The consumer of the service is a Windows Phone app.
On my computer everything works great. But if I publish the WCF Service (on the web or on localhost), and try to use it from the phone application, it generates an error
"The server was unable to process the request due to an internal
error."
By testing I found out that the error comes at the line connection = new MySqlConnection(ConnectionString); On my laptop everything worked (when I debugged the project), I tested my WCF Service and it perfectly accessed the database and did everything well. Again, when I publish at localhost or on web, accessing the service causes an error.
I published the log file here.
What is wrong? What can cause this problem?

Finally, I found what was the problem.
This question helped a lot. It turned out that the problem was with MySql.Data.dll. It must be copied locally (by default that property is set to false). Without that, the program doesn't find the library and throws an exception. So I needed to change the setting to 'Copy To Local = true'

Related

Web-Service not working without reference update

I got a WPF project that is using ASMX web-service to connect to database. The problem is I can't connect to the web-service without updating web-service reference. Even if I've updated reference and then built the solution I can't connent to the web-service after closing visual-studio.
In this situation, it appears VS is hosting your web service via Cassini or IIS Express. That port number is a setting that can be changed in the project's configuration. When you close visual studio you are closing the web application host. If you are attempting to test your service locally, without VS hosting, then you will need to configure a new web application to run on a local instance of IIS pointing to the output directory of the service. You can still bind inside of your solution to the services' project reference, you just don't need VS running to access it locally.

Calling SSIS package from WCF

There was a similar question asked here, but no real answer.
Here's the previous question:
Invoking SSIS Package from WCF service (tcp binding)
I have a very similar problem. I've got a VB.net application for the UI, and it calls a C# WCF service that I'm hosting locally in IIS, which in turn calls an SSIS package that I've deployed to SQL Server 2012 using the Project Deployment method. If I use the WCF Test Client to test the WCF call to the SSIS package, it runs fine. Once I deploy the WCF service to IIS, then try to run my VB.net app in Visual Studio 2013 and step through the code calling the WCF service, then step into the WCF service code, once it gets to the line of code that attempts to connect to my SQL Server instance, I get an exception stating
Failed to connect to server
The InnerException is
Login failed for user 'DomainName\PCName$
The connection string in the WCF code is like this:
SqlConnection connection = new SqlConnection(#"Data Source=PCName\SQLServerInstance;Initial Catalog=DBName;Integrated Security=SSPI;");
I've tried adding a Windows Authentication login to SQL Server for DomainName\PCName$, but it made no difference. Why would the WCF service be able to successfully connect to my SQL Server instance when I test it in Visual Studio using the WCF Test Client, but not be able to successfully connect once I publish the WCF service to my local IIS?
Please help me, I've tried EVERYTHING (I think). . .
I found the fix! Thanks for the suggestion Dean - this was a doozy. I'm new to posting to Stack Overflow, so please excuse my poor formatting. Basically, the answer was found here:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ff441dc3-b43b-486b-8be1-00126cf53812/calling-ssis-packages-from-aspnet-packages-with-file-system-tasks-end-abruptly?forum=sqlintegrationservices
I created a new application pool in IIS, just for WCF services. I changed the Identity of that pool to a user that was an admin and had dbo privileges on the SQL Server DB. I then moved my WCF service to that new application pool, restarted IIS, and everything worked!

Azure mobile service: publish throwing error VS 2013

I was trying to create azure mobile service from VS 2013, 2 issues I am facing.
Host in cloud option is disabled.
Getting error on click of Validate connection while publishing the project. error thrown there is "Destination is unreachable".
Log I have extracted from output window is :
Error ERROR_DESTINATION_NOT_REACHABLE: Web deployment task failed. (Could not connect to the remote computer ("****.scm.azure-mobile.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.)
I have attached screenshot you reference. Please check.
gone through similar question : Not able to publish website on Windows Azure using publish through VS2010
didnt helped though.
Can anyone help me to resolve these issues..? Appreciate the help.
Regards
Ravi Bhat
I encounter this error as well.
I tried changed two things and it works, yet now I don't remember which one is the root cause:
use https instead of http for the server address and destination URL
My company has proxy settings for all internet access, I change to the other WIFI without any proxy. So check your internet connection.
You could try this, but I'm not sure if it works.

The Reference.cs file in a WCF service always returns an empty file in localhost mode

I've read numerous posts on this, but none help at all...
My situation is actually very similar to others, however, it only affects me when I'm trying to debug locally. When using my actual PROD service, the Reference.cs file gets generated fine.
I also tried running the client under the VS development server and on Local IIS Web Server using IIS Express.
No errors occur during generation of the proxy and I have triple verified that my DEV client matches up to my DEV service.
If anyone has any solid ideas on how to resolve this, I would appreciate it since it is preventing me from debugging locally with my service.

Can i consume WCF service inside windows mobile 6 project?

Can i consume WCF service inside windows mobile 6 project??
I spend many days to solve my problem of adding web reference of WCF to smartdevice project
but the smae error appears.
There was an error downloading 'http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/mex'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:8731
There was an error downloading 'http://localhost:8731/Desi
So i ask is it possible to consume WCF from windows mobile 6 project??
I create WCF and windows mobile projects in visual studio 2008 and when i "add web reference" to the mobile project to add the WCF and put the URL i get this error
"There was an error downloading 'http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/mex'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:8731
There was an error downloading 'http://localhost:8731/Desi"
however i change the "localhost" to my computer IP address the same error appeared.
How can i write the URL that will be put in the client application.
The important part of the error is "Unable to connect"
This means that the add service reference has tried to make a call to the service, but the call failed.
The most likely reasons for this are:
The service is not running
The metadata exchange (mex endpoint) is not enabled
It looks like you're trying to get the Mex, but the service isn't running on the dev machine:
Try going to this url in your browser
http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/mex
you'll probably get the same error (machine actively refused it)
Make sure the service is started.

Categories

Resources