Azure Web Sites Config Error - c#

I'm trying to deploy a mostly empty asp.net webforms app (with a custom httpmodule specified in web.config) to Azure and getting the following error:
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please review the
specific error details below and modify your configuration file
appropriately.
Parser Error Message: An error occurred loading a configuration file:
Access to the path
'D:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\xqhbvcov.tmp' is
denied.
Source Error:
[No relevant source lines]
Source File:
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
Line: 0
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.276
Any ideas? I'm not sure what other information may be pertinent so if I'm missing something vital please ask and I'll supply it.
Entire web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<!--<httpModules>
<add name="AbcdModule" type="org.abcd.abcdHttpModule"/>
</httpModules>-->
</system.web>
<system.webServer>
<modules>
<add name="AbcdModule" type="org.abcd.abcdHttpModule"/>
</modules>
</system.webServer>
</configuration>

I had discussion with Windows Azure Websites team and found that custom HTTP Modules are supported with Windows Azure Websites so they should work and problem could occur depend on how complex the registration is.
For the sake of testing, I use the link below to create a custom HTTP Module and tested it in Azure Website which worked without any issue:
http://msdn.microsoft.com/en-us/library/ms227673%28v=VS.100%29.aspx
If you can provide more info about your custom HTTP Module (which seems to be part of org.abcd namspace and anything else) we sure can help. Alternatively you can submit the request at Azure Websites Forum, someone can help you directly.

Related

.net core 2.0 app blocks plesk-webstat

I published an aps.net core 2.0 mvc app to a shared web hosting server that uses Plesk as control panel. The app works fine. However, I got the following error message when trying to access the web statistics:
This example.com page can’t be found
No webpage was found for the web address: https://example.com/plesk-stat/webstat/
HTTP ERROR 404
I contacted their support and got the answer "the .net core application settings aren't allowing the webstats to load. We recommend you consult with an experienced website developer to customize the web.config code accordingly for the website.", but they don't know how to configure the web.config file.
I really want to make the webstat to work. Any suggestion will be appreciated.
If URL Rewrite is blocking the access, try adding this string to the <conditions> section of the rule which is affecting webstat page:
<add input="{REQUEST_URI}" pattern="^/(plesk-stat/webstat)" negate="true" />
If that does nor help, configure failed request tracing to find which exact module is performing a redirect.
Along with changes in the web.config of the ASP.Net Core site itself to send the /plesk-stat/ url to IIS, a web.config must be added in the following directory:
C:\Inetpub\vhosts\{domain.tld}\.plesk\statistics\{domain.tld}\
(replace {domain.tld} with your domain), with the following contents:
<configuration>
<system.webServer>
<handlers>
<remove name="aspNetCore" />
</handlers>
</system.webServer>
</configuration>
This has to be done by the hosting provider on the server. Maybe you should contact the support of your hosting provider.

Server Error in Application when hosting Web Service on Azure

I am trying to host my web service that is done in ASP.NET on Azure. I managed to get the front page to be displayed correctly, however, when I click on a button to direct to another page, it gives me the following error:
I have tried adding the following code in my web.config, web.debug.config and web.release.config:
<customErrors mode="Off"/>
I have also tried uncommenting the following in my web.debug.config and web.release.config, but it did not work:
<customErrors defaultRedirect="GenericError.htm"
mode="On" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
However, I do not encounter errors when I run it on localhost.
Can anyone help with this? Been trying to debug it for quite a while and I have tried following online sources but have still get the same error.
From your mentioned screenshot, it just the common information. You could follow Troubleshoot a web app in Azure App Service using Visual Studio document to troubleshoot. Such as add custom error off in the Web.config file or remoting debug webApps, etc.

How to deploy ASP.net website on somee.com?

I am trying to deploy sample website on somee.com using free hosting.
First I published my website as a folder. I already tested on my local machine on IIS 7 in my local machine. That is working fine without any problem.
1. I created new free hosting domain on somee.com, then in file manager ->
2. Then I make a zip folder for my published website folder
3. Then I upload the zip folder and select upload and unzip archives
4. Now this is my root folder file structure
5. I hope it will run the default.aspx file. Then I try to visit my site it throws error like below
Error msg
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0016: Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b2d18bbc\3889fee\App_Web_home.master.cdcab7d2.cugbgmun.dll' -- 'Access is denied. '
Source Error:
[No relevant source lines]
Note
I created one small default.htm file for testing. If I upload that file. That's working fine.
Web.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
If I add the default.aspx file as a start up page on web config like below,
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="Default.aspx" />
</files>
</defaultDocument>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
Error msg
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
Here are steps to publish your .net to the server:
Please open your project with Visual Studio tool
On the Solution Explorer windows (which is normally located on the top right hand corner of the VS tool), right click your project and select Publish
Please kindly publish it to a local folder, such as C:\Project
Please just upload whatever files/folders you see on C:\Project to the server via FTP and your site will work fine.
The steps will remain the same. If you face 500 internal server error, please ask somee to check full error message on the server.
In Web.confilg file turn on the customErrors
<system.web>
<customErrors mode="On">
</system.web>
now add connection string carefully .Only change provider connection value
<add name="DBModel" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;**provider connection string**='your database connection path'" providerName="System.Data.EntityClient" />

Create a connection string / connect to a database in asp.net?

I am trying to publish a website to make it go live and need to connect to a database. Currently I am using:
<connectionStrings>
<add name="UniversityContext" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=RoomAudit;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\RoomAuditSystem.mdf" providerName="System.Data.SqlClient" />-->
</connectionStrings>
in my web.config which obviously using my local machine.
I've looked online and on here and can't seem to find a clear cut tutorial. Here is the database details:
DATABASE SERVER
mysql4.gear.host
with my username and password with reading and writing permissions.
If someone could point me in the right direction I would appreciate it - I'm also using Entity Framework if that makes any difference?
EDIT:
This is my new connection string:
<add name="UniversityContext" connectionString="Server=mysql4.gear.host;Database=databasename;User Id=username; Password=password;" providerName="System.Data.SqlClient" />
However, when I publish the website I get a runtime error?
Runtime error:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
Console error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
IMO, best place for learning to write connection strings is here: https://www.connectionstrings.com/sql-server/
Try this
<add name="UniversityContext" connectionString="Data Source=mysql4.gear.host;Initial Catalog=databasename;User ID=username;Password=password" />
I suggest to create file with .udl extension and test configuration.
It could help you to find proper parameters.

IIS 7.0 REST Web Service 404 error

I have a REST C# web service that runs fine under IIS 6.0 and IIS 7.5 but for some reason I get a 404 when running under IIS 7.0.
The path to my dll is as follows: wwwroot\PHSendMessage\bin\PHSendMessage.dll
My web.config is the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpHandlers>
<add type="Service, PHSendMessage" verb="*" path="Request" />
</httpHandlers>
<httpRuntime requestValidationMode="2.0" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
The class that inherits from IHttpHandler is named Service and this class contains the ProcessRequest function.
I am attempting to run the following url: http://localhost/PHSendMessage/Request?xml=hello
The above URL should call the get method and return the value from the "xml" parm to the screen, but I get a 404 error instead.
Everything I have read seems to point to the handler is not found, or not routing to my DLL correctly. I am not sure if the Web.config needs to have additional entries that are not required in IIS 7.5.
I have tried to follow numerous guides to adding the handler mapping but always the unhelpful 404 error. When following said guides I enter the Path and type similar to how I entered it in the web.config above and I may not be entering those correctly as I do not fully understand how these httpHandlers route to my dll.
Edit: I followed the following example: http://www.codeproject.com/Articles/112470/Developing-a-REST-Web-Service-using-C-A-walkthroug
I also followed their link to 404 errors. The source code from the above link is also results in the same 404 error.
Has anyone had similar issues?

Categories

Resources