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!
Related
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.
I have WCF web service for connecting to a SQL Server database on a server and to return data in JSON format.
I can run this web service on my laptop from Visual Studio 2013 correctly when I am connected to the network what server is in it, with this url :
http://localhost:51220/Service1.svc/checkLogin?name=username&pass=password
I want to publish this web service and put it on a server (where the SQL Server database is installed). To access the web service from the internet, a url like this will be used:
http://serveraddress:51220/Service1.svc/checkLogin?name=username&pass=password
Now, how can I publish this web service from my laptop to the server? What configurations should be set in the publish settings?
And after publish, I have 3 files: web.config, service.svc and Sample.dll, what can I do with them? :)
I am very amateur on make binary from WCF web service.
You should host the service in the IIS, a simple tutorial can be found here:http://www.codeproject.com/Articles/550796/A-Beginners-Tutorial-on-How-to-Host-a-WCF-Service
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'
I have developed a web service in VS2008 in C#. The service queries a SQL Server Express 2012 database and returns the results. When I test the service on local development system it works fine.
Now I have a windows azure trial account, and I want this service to be deployed on a virtual machine.
1- I have tried to create virtual machines with SQL server and Visual Studio on it, but could not create the service there. VS does not have the Web services template there.
2- I have tried to create the deployment package on my dev system and tried to install the service but it also did not work.
Please suggest the correct way of doing this task. I am very much new to all these concepts so may be I am missing some basic information and a step by step guide will not hurt.
Install Visual Studio 2012 Express for Web
Get your application working in that version, and preferably upgrade it to .NET 4.5.
Create a Windows Azure SQL Database by following this Getting Started guide.
Download version 4.0.15 of the SQL Azure Migration Wizard from CodePlex.
Use the wizard to migrate your local database to Azure, being sure to fix all the problems it reports.
Set up a Windows Azure Web Site and publish your service to it as described in this article.
I am not sure that you did it that way, but the easiest way to create a cloud-hosted web service with MS SQL Backend would be:
Create a new instance of SQL Azure in Azure Management Portal.
Create a new database (probably a web edition in your case).
Use the connection string from the portal and Azure SDK to develop an ASP.NET application (web role) hosted on Azure. You can locally test this application in the similar way how you test your current ASP.NET application, provided you set up the firewall on your SQL Azure instance for inbound connections from your external IP.
(here is the step-by-step tutorial for the first three steps)
Create a new instance of cloud service in Azure management portal.
Deploy your application to the cloud directly from Visual Studio. You'll, however, need at least Visual Studio 2010 and the Express Edition would already do.
(Update: As Mark Rendle suggests in the comment and in his answer, there is no need to create a separate cloud instance as long as your service is light-weight and does only data fetching. Cloud instance would be, however, essential, if your service requires data processing or has some other logic entailing long-running processes).
Alternatively you might want to use Azure Mobile services, that already provide a web service for SQL Azure that might do. This is a fully RESTful web service and you'll just need to write some logic in JavaScript, similar to Node.js implementation. See an excellent tutorial on this issue.
I created a service that has a database connection which is working fine in Cassini, when in copy the service to the inetpub all works fine except database calls, they always return this error:
The server encountered an error processing the request. See server logs for more details."
Now i have 2 questions,
I can find server logs in my C:\inetpub\logs\LogFiles\W3SVC1 folder. But are these the ones mentioned because these do not seem to contain any usefull data.
How is it possible that everything works in Cassini but not in IIS?
If there are any questions about my question please go ahead!
Edit I am using Visual studio team system 2008 and IIS 7.0
This is normally a permissions problem.
If you are using defaults:
The connection string is using a trusted connection
When you run via cassini you are in the security context of your user
When you run via IIS you are in the security context of the identity of the application pool which is network service.
To fix it you could:
change the connection string
change the identity of the application pool
give network service access to your database
Run Visual Studio as administrator
My guess is permissions. Are you using Windows authentication?
In the case of Windows authentication:
http://www.codeguru.com/csharp/.net/net_security/authentication/article.php/c7725