Cannot add service reference to ec2 instance errors=404/405 - winforms

I used MS Web Deploy to successfully publish a WCF service to an AWS EC2 Windows 2012 Server. But when I try to add a service reference to a WinForms VB.NET applicaiton, the following error is displayed:
There was an error downloading 'http://ec2-XX-XXX-XX-XXX.us-west-2.compute.amazonaws.com/PPWebService/Service1.svc'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://ec2-XX-XXX-XX-XXX.us-west-2.compute.amazonaws.com/PPWebService/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.
I tried rebuilding the client application and adding the service reference again, but received the same result.
I am wondering how to resolve the (405) Method not allowed error or is it even possible to add a service reference to an EC2 instance?
TIA

Can you access the wsdl url from the browser? if so check if it contains a reference to http:// localhost... and if so try useRequestHeadersForMetadataAddress.

Related

How can we connect to snowflake using DB Visualizer using Azure AD

I am using the following Database URL in DB Visualizer to connect to snowflake using Azure AD authentication
jdbc:snowflake://accountname.snowflakecomputing.com/?authenticator=externalbrowser&warehouse=xxxxx_WH&db=xxx_db&schema=xxxx_schema
I am getting the following error : JDBC driver encountered communication error. Message: Exception encountered for HTTP request: sun.security.validator.ValidatorException: No trusted certificate found.
This error is usually indicating that the jvm can't find the necessary certificates. You can refer to the following link for further troubleshooting:
https://community.snowflake.com/s/question/0D50Z00009LHQMSSA5/how-do-i-resolve-no-trusted-certificate-found-error-when-connecting-to-snowflake-via-jdbc-driver-in-java
See if you can export JAVA_HOME to match the jdk installation where your cacerts is located. It is usually located under <JAVA_HOME>/lib/security/cacerts.
-pd

i am trying to deploy ASP.NET CORE API Version 3.1 to local IIS Hostiing but can not connect to SQL Server

I have deployed asp .net core api app on local IIS Manger when i call action that need to retrieve data from sql database does not work,i opned C:\inetpub\logs\LogFiles\W3SVC3 found 404 not found error ,
i found another error in my log as Login failed for user 'IIS APPPOOL\service' ,
but when i call another action that returns local data it works fine here is my connection string
"ConnectionStrings": {
"ERPConnection": "server=.; user Id=ssa;password=12345678;database=dbname;trusted_connection=true;MultipleActiveResultSets=true"
},
and my application pool is not manged code :
Where is your SQL Server instance hosted? If its localhost try using the full local host domain name.

ASP.NET Core Web Api publishing to IIS producing an Sql Server connection error

I've created a simple web api in asp.net core 2.0 which uses localdb as the backing datastore. It works completely as expected in debug - I'm able to send requests from postman (or browser) and step through my code. Here is my connection string:
"Server=(localdb)\\MSSQLLocalDB;Database=UniversityDatabase;Trusted_Connection=True;MultipleActiveResultSets=true"
I now want this to be running constantly so that I can consume it from a Xamarin.Forms project so I have tried publishing the web app using the Visual studio wizard.
1.
2.
UniversityApi then appears in IIS under Default Web Site but not as an application. I choose to 'Convert to Application' which shows me this dialog:
3.
The NetCoreApps Application Pool uses No Managed Code.
Error:
{
"error": [
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.\r\n)"
]}
The error seems to describe a problem with connecting to my Sql Server instance which is strange because it works perfectly while debugging in VS. Any ideas?
After searching for a while I stumbled onto this question:
SQL won't connect after deploying
One of the answers did the trick for me, credit to Robotron.
IIS Manager
Application Pools
Find the pool your app belongs to (for me it was .NET v4.5)
Right click -> Advanced Settings
Scroll down to Identity
Change from whatever (for me it was ApplicationPoolIdentity, same as you have) into LocalSystem.
Add the "LOCAL SERVICE"(Windows account) to SQL Server.
Change from "ApplicationPoolIdentity" to "LocalService" in (IIS Application Pools Advanced Settings)
NOTE. ADD "LOCAL SERVICE"(Windows account) need Permission into SQL Server.
Thanks a lot for the answers. I have similar problem. My .net core web api is hosted in AWS. It was working before when I was just accessing the api via ip address (sample https://xx.xx.xxxx/swagger) but when I integrated it to domain (https://xx.sampledomain.com/swagger) I ran into the same problem. These two steps solved the error.
1st I used the LocalService account for IIS Application Pool, then added the NT Authority/Local Service account in the MS SQL Server 2016.
enter image description here
On the Publish screen > Database > DefaultConnection, I ticked on the 'Use this connection string at runtime' checkbox.
enter image description here

Internal server error Login failed for user 'DOMAIN\MACHINENAME$'

I am stuck and can't figure this one out.
I am using VS2017 to deploy a Angular 6 application with a Dot Net Core 2 back end that talks to a SQL Server DB on a remote server. I am not using and ORM or EF system, just straight ADO connections.
I am getting this error =
error: "Internal server errorLogin failed for user 'DOMAIN\MACHINENAME$'."
500 Internal Server Error
I have tried the following things:
making Sure the connection string does not have Integrated Security = true
making sure App Pool is set to No Managed Code
that the app is not set up to use NETWORK SERVICE or LocalSystem as login
This all seemed to start in the past 2 weeks. Before then, while the app was more simple, it was still connecting to DB just fine. So I am not sure what would cause this error.
I do not get this error when using the site locally on my dev machine (loccalhost). Everything connects and gets data just fine there.
This is only when I deploy to our servers...
Ideas?
EDIT FOR QUESTIONS
Connection string = data source=<IPADDRESS>;initial catalog=<DBNAME>;user id=<DBUSERNAME>;password=<DBPW>;Trusted_Connection=True;
You have Trusted_Connection=True; in your connection string; remove it, since you are trying to use a username and password rather than Windows authentication.

Web application network or sql error when trying to launch instance of site via Internet Information Services

Trying to do this exercise. I have an issue. I'm trying to launch an instance of this API. I'm installing the files locally and trying to publish the site/ api via Internet Information Services (IIS). My files / site are supposed to be communicating with a company's server and the web app is therefore supposed to launch. The directions have me install SQL Server Express local db, which is the utility that I believe is supposed to help communicate with the company's server. By the way, I'm on Windows 10.
When I follow all the directions and hit browse on the site from IIS, I keep getting this error. Can anyone please possibly help me?? I have tried all sorts of stuff. The sql express local db doesn't even have a UI so I've been able to start it from command line, so I know it's running, but still nothing. Anyone?
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)]
please click here to see the error screen I keep getting in browser upon trying to launch instance of this web application/api
please click here to see the error screen I keep getting in browser upon trying to launch instance of this web application/api
Check this blog post: https://blogs.msdn.microsoft.com/sqlexpress/2011/12/08/using-localdb-with-full-iis-part-1-user-profile/
So basically you need to set setProfileEnvironment=true and loadUserProfile=true for your application pool. loadUserProfie setting can be set using Applicaiton Pool advanced setting via IIS Manager but setProfileEnvironment requires editing ofApplcationHost.config file
Go to C:\Windows\System32\inetsrv\config and open applicationHost.config in text editor.
Search for your applicaiton pool name e.g. DefaultAppPool
Set loadUserProfile="true" setProfileEnvironment="true" for your application pool:
<add name="DefaultAppPool" loadUserProfile="true" setProfileEnvironment="true"
Remember to restart Application pool after editing the file.
Hope this helps

Resources