Error in webservice after publishing - c#

I created a webservice when it hosted on my local computer it works fine, but when i publish it to the web host, it doesnt work any more, i guess its a question about how the webserver is configured, but can i make some changes in web.config so it will work?
The error i get is below:
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: Could not load file or assembly 'MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 37:
Line 38:
Line 39:
Line 40:
Line 41:
Source File: c:\webs\talkactive\gb1634\qaz.dk\web.config Line: 39
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
The webservice uses a c# class placed in the app_code folder. That c# class uses mysql.
When i use the class in a normal .aspx file it works fine

I guess the obvious thing would be to check whether the MySql.Data exist in the GAC (or the web service's bin folder) on the server and is of the correct version and public key?

Basically, you are missing this DLL. You should look at putting it in the bin directory of your webservice.

There could also be a versioning conflict between the MySql client you want and what is installed on the server. You can add the following section to your web.config file and specify the proper version/public key you need:
<compilation debug="false">
<assemblies>
<add assembly="MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</assemblies>
</compilation>

Related

How do I resolve "Could not load file or assembly 'log4net, Version=1.2.10.0,PublicKeyToken=692fbea5521e1304"?

I get the following error:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
The error occurs on this line:
ReportDocument rptd = new ReportDocument();
I have configured IIS to run 32-bit applications:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
If this option is not available to you, follow these next steps:
Go to %windir%\system32\inetsrv\
Execute the appcmd.exe tool:
But error persists.
As the error describes:
you are missing the log4net.dll
you need to copy the described log4net.dll in the executing directory
Comment this line in web.config
assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304'
and exclude log4net.dll from your References folder

Could not load file or assembly 'Microsoft.Web.Iis.Rewrite.Providers, Version=7.1.761.0, Culture=neutral, PublicKeyToken=0545b0627da60a5f'

I have setup ASP project but when I am opening my local url in browser I am getting below error:
Parser Error Message: Could not load file or assembly
'Microsoft.Web.Iis.Rewrite.Providers, Version=7.1.761.0,
Culture=neutral, PublicKeyToken=0545b0627da60a5f' or one of its
dependencies. The system cannot find the file specified.
Line 16: <compilation debug="true" targetFramework="4.6.2" defaultLanguage="c#">
Line 17: <assemblies>
Line 18: <add assembly="Microsoft.Web.Iis.Rewrite.Providers, Version=7.1.761.0, Culture=neutral, PublicKeyToken=0545B0627DA60A5F" />
Line 19: </assemblies>
Line 20: </compilation>
Had the same problem using a DB provider. Fixed it by installing the URL Rewrite extensibility code samples.
During the installation make sure to select the "Runtime" option in the custom setup. This will register the sample providers in .NET Global Assembly Cache so that they can be used by URL Rewrite Module.
Using Custom Rewrite Providers with URL Rewrite Module
You error message indicates that the DLL is missing. Have you installed the IIS URL Rewrite Module?
For more another possible solution you can look at this post.

Double error in Web.config file ASP.NET MVC

So when I publish my application I these following errors which I do not get in local mode.
"System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.SecurityPermission, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed."
So it is said that I'm supposed to write the following code in my Web.config to solve this first error:
<trustLevel name="Full">
So I did, but then, I got this error:
"This configuration section cannot be used at this path. This happens
when the site administrator has locked access to this section using
from an inherited configuration file."
It apparently has to do with the machine.config (which I cannot find)...
Does anyone have a proper solution for this?
If you wish to test it yourselves, here is the URL:
http://wideart.se/Exhibition
Regards
What is around <trustLevel name="Full"> ?
Is it inside system.web?
Try
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>

Two errors in Web.config ASP.NET MVC

so firstly, I get this error when publishing my web application:
"System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
So it is said that I'm supposed to write the following code in my Web.config:
<trustLevel name="Full">
So I did, but then, I got this error:
"This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using from an inherited configuration file."
At it has to apparently have to do with the machine.config (which I cannot find)...
Does anyone have a proper solution for this?
Regards,

Web API Deployment error

I get the following error when deploying my Web API Project that is targeting the .NET 4.5 Framework. I have made sure that all the referenced DLL's are in the bin folder.
Please have a look below and see the error:
Server Error in '/' Application.
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: The 'targetFramework' attribute in the element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, ''). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.
Source Error:
Line 22: </appSettings>
Line 23: <system.web>
Line 24: <compilation debug="true" targetFramework="4.5" />
Line 25: <httpRuntime targetFramework="4.5" />
Line 26: <authentication mode="None" />
Source File: C:\inetpub\wwwroot[website folder name]\web.config Line: 24
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
If i comment out line 24 and 25 i get a different error:
Server Error in '/' Application.
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: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
Source Error:
Line 109: <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 110: <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
Line 111: <add assembly="*" />
Line 112: </assemblies>
Line 113: <buildProviders>
Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config Line: 111
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Net.Http' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Are there two related in anyway?
How do i go about solving this problem?
Any help would be greatly appreciated.
Activate the feature WCF HTTP Activation for .NET 3.5 and 4.5 and try again:

Categories