MYOB ODBC ASP.NET application issues during insert command from IIS 10.0 - asp.net

I am trying to develop a ASP.NET Web API for MYOB that runs within IIS. That will allow me to insert/update/select different pieces of information from a MYOB company file.
At the moment within development everything works perfectly from within VS 2015 using IIS Express. I can successfully execute a insert command on the MYOB ODBC connection in multi-user access mode while the company file is opened by atleast two other users.
However when run from within IIS no errors are displayed. However the ODBC driver returns successfully on the insert query despite no insert being completed and no records of errors in any log files.
Finally, i have given the application pool connected to the IIS Application/Website the identity of the system administrator account. So i am assuming this is not the issue.
Could someone please help me on this! Have I maybe setup the permissions and security protocols in IIS incorrectly? As this application works fine within IIS Express but not in IIS?
Thanks in advance for any help!

You eventually couldn't see an error because you are using Web API. You are just a client. But maybe the API has an error that you've couldn't be seen. is your API has a LOGS? or it has a return value when it might encountered an error?
Try to Double Check it.
I agreed there's a big difference between iis express and IIS itself(Not in VS, means other machine or in server)
Check it too.
1.) framework you are working mostly.
2.) make sure that your Web API is running.
3.) IIS set up.

Related

ASP.NET Core - Application not connecting to database after publishing

I created a simple ASP.Net Core application with user authentication (so all the Entity Framework has been preloaded into the web app template). It is connecting to my database with the connectionString that is located in my appsettings.json file, with "data source = {computerName}\\{serverName}" setup.
The database instance and Visual Studio are located on the same machine. This works fine in returning data to the web api while within development and debugging mode. When I publish it and try to go to the site from a domain name it does allow me to view the webpages that are not needing database connection but the rest that need data from the database returns pages like this:
Error.
An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
I have tried to change the Environment Variables for ASPNETCORE_ENVIRONMENT from Development to Production to no success.
I have tried adding appsettings.Production.json to publishOptions in my project.json file, even though there is no file appsettings.Production.json, and this did not help. dotnet publish
Adding the evironment variable in the web.config file did not work Deployment
I need help getting the published web api to connect to my SQL Server database from outside the development Visual Studio setup.
The last thing I can think of is that maybe I am incorrect in how I understand the connection string. If the web api uses the connection string to connect to the database from the server-side then it should work just fine like it does when in development calling to http://localhost:port# since it's all on the same machine. But, if the database string needs to be based on a client-side call then it would have to be with domain names and IP addresses.
Can someone tell me which one it is?
The only thing else that comes to mind is that there is something I am not doing, and need to do, inside of IIS Manager. I see connect string there as well but unsure what that is for our does since the connection string is inside the application. Also maybe I am suppose to give the app some kind of authorization to communicate with the database server even though they are on the same machine???
After much research, finally googling "how to deploy a web api in iis" I was able to learn from Host ASP.NET Web API in IIS using Visual Studio Publish that I needed to add the security entity BUILTIN\IIS_IUSRS. Then placing a mapping to my database tables and giving db_datareader (and possibly db_datawriter) for the database to the IUSER to allow access from my self hosted IIS web api. This from the above mentioned link with the part stating
Accessing Database under IIS APPPOOL\ASP.NET v4.0
As we are using ASP.NET v4.0 App Pool make sure IIS APPPOOL\ASP.NET v4.0 is added to your Database Server -> Security -> Logins.

Tool to check if all website pages are working without error in ASP.Net?

Presently i am working on a website it has around 50 pages and links. I need to make sure that all the pages are running fine before deploying to production. Is there any tool so that i can check on local machine that no page is displaying an error message of any kind.
Note:- i am making website using ASP.Net, SQL Azure, Window Azure.
You can try this - http://www.relsoftware.com/wlv/
I'm not pretty sure what do you want to check. If it's related with your business logic you have to check by yourself, or by some unit test framework. For windows azure deployment verification, I would like to recommend you to do as below:
1, Since you said you are using Windows Azure and SQL Azure, please have two server for testing. One to simulate the windows azure environment, installed Win08 x64 (R2 if you are using Azure OS 2.x), .NET Fx 4.0 (or 3.5.1 if you are using 3.5 SP1), Windows Azure SDK, IIS with URL rewrite. Do NOT anything else on this machine, for example VS, Win SDK etc. On another machine to simulator SQL Azure, just install SQL Server 08 R2.
2, Deploy your azure application on the first machine using CSPack, CSRUN, etc. and connect to the SQL Server on the other machine, test your application. If you are using storage service, firstly using the local emulator on the first machine.
3, Change to use real azure storage and test.
4, Change to use real SQL Azure and test.
5, Deploy your application on azure staging slot and test.
6, Swap to production slot.
In SDK 1.5 and later the Azure VS Tool have a feature to help you to verify if there's any assemblies you referenced in your project are missing on azure VM. So you can set them as Copy Local = True. There's also a website help you to verify the assemblies http://gacviewer.cloudapp.net/
Not entirely sure on what errors you might want to check, but if you just only want to check for broken links then there is a tool called Xenu that could help you. It will traverse all of the links and send back nice HTML reports on the broken links.
Would ELMHA help here?
http://code.google.com/p/elmah/
Check out Wades post for Azure usage: http://www.wadewegner.com/2011/08/using-elmah-in-windows-azure-with-table-storage/

Crystal Report VS 2008 - multiple tables report deploy

I am having a problem with deploying a multiple tables report into my IIS server. The page shows : "The report you requested requires further information". However, I have tried to set databaselogon at the server-side but it didn't work. (The report is working fine on VS Debugging Mode)
It is confusing that it happens only to a multiple tables report and it is working fine on a single table report.
I am using VS2008 and CrystalReportViewer version 10.
When you get "The report you requested requires further information", are you prompted to log in? I think that is the header message for DB authentication required.
If so, what you need to understand is the concept that the Crystal Reports runtime runs within the security context of the ASP.NET server. Your database connections within the Crystal Report are probably set up to use Integrated Authentication, which means the report will authenticate to the DB server using the credentials of the ASP.NET process.
In debug mode, the ASP.NET development server runs as your user account. Undoubtedly, you have access to the DB. However when you try to run in production mode, the ASP.NET server (by default) is either running as a local account called ASPNET on the IIS server, or as the NetworkService account, depending on what version of IIS you are running.
If you are running IIS 7.x, you need to either give the IIS server's directory object (NtDomainName\ServerName$) access to the DB, or change the security identity of the application pool associated with your ASP.NET application.
Hopefully this sets you on the right track and if you still need more help please post what version of IIS you are running and more information on the error message you are getting.
Response to Comment:
To configure Application Pools, in IIS Manager, select the Site in question, click Basic Settings... and check the Application Pool it is assigned to. Then go into Application Pools, you should see the current Identity of the pool listed. This is the account the application "runs as". This account needs to have access to all the files and resources in your web application, including your MySQL DB.
You can edit the Identity settings in the Advanced Settings dialog for the Pool.
Unfortunately I can't give you any advice on MySQL since I have never worked with it.

Permissions problem when accessing remote files from my Web Service

My web service needs to open some files located on a remote computer.
From Windows I can do the authentication so I can see those files using the File Explorer.
If I try to open the files from my Web Service while it's running using Visual Studio (ASP.NET Development Server) it also works.
However, if I do everything from IIS it doesn't.
In order to find out where is the problem what I did was to run a network sniffer and I found out that when using IIS, the system will try to use the account 'ASPNET' to login into those remote computers which will obviously fail.
However this doesn't happen if I run from the IDE (Using the ASP.NET Development Server)
I found out that if I use Impersonation for accessing this it will work, the problem is I need to have the same account names on the computer running IIS so I would rather not to do that.
Why is it working from the ASP.NET Development Server and not from IIS? Is there a way to give full access to the ASPNET account?
Thanks and hopefully somebody will be able to help with this. I don't know what else to try...
Any request on IIS is served by the ASPNET user. So the user ASPNET is working. I think you are using XP. On Win2K3 etc, the user is Network Service
But the Cassini (Visual Studio Dev server) runs under the current logged in user.
So the difference is. You need to use impersonation for your need.

Unable to start debugging on the web server. The COM+ registry database detected a system error

I'm trying to debug an ASP.NET webapp that's configured to "Use Local IIS Web Server" on WinXP. When I start the debugger, the compile succeeds, and then the following error is displayed in a dialog:
Unable to start debugging on the web
server. The COM+ registry database
detected a system error
The webapp never launches in my browser. How can I get rid of this message and debug this webapp?
I tried the usual stuff, and my exact scenario ended up being described a post in the MSDN forums. Its answer worked for me, despite my environment (VS2008, .NET 3.5) being more modern:
Here are the steps I followed (basically a summary of the link above -- "ASPNET" being significant because that's the user running the IIS instance on my development box):
Close VS
Shutdown IIS
Add ASPNET to the local Administrators group
Start IIS
Start VS and successfully debug ASP.NET webapp
Close VS
Shutdown IIS
Remove ASPNET from the local Administrators group
Start IIS
Start VS and continue debugging ASP.NET webapp without error
My development workstation's security settings/situation is regularly managed by our security folks here, so something must have upset my ASP.NET/IIS/etc environment.
I am using the Visual Studio 2002 and I had the same problem, with tha same Error Message. To solve it, I did only the first 5 steps of the solution recommended before.
I am starting in VS 2002 because I use it in my work. I have the basic concepts, but I never develop in this program language, so I am a begginer.
The most important point in this solution I believe it is understand that ASPNET is a user in the development machine, as Administrator, as "Name.LastName" or any other user that access the machine. When I search for ASPNET to add in the Administrators Group and found it, made a lot more sense because I don't know exactly how the .NET architecture works.
So, if you have the same problem, I here confirm this solution solved my problem, even when I reboot my machine:
Close VS
Shutdown IIS
Add ASPNET user of the Machine to the local Administrators group
Start IIS
Start VS and successfully debug ASP.NET webapp
Thanks for the solution!!

Resources